SDK Reference
OpenSteer Extraction API Reference
Extract structured browser data with OpenSteer schemas and replay-friendly extraction planning for AI agent workflows.
Quick Answer
Extraction APIs let you generate structured outputs using schemas and replay-aware plans so AI workflows stay stable over time.
Extraction
extract<T>(options: ExtractOptions): Promise<T>
Extract structured data from the page.
schema describes the output shape, not just selector bindings. You can use
semantic field hints such as "string" and arrays of objects for AI
extraction, or explicit bindings such as { element: 3 },
{ element: 5, attribute: "href" }, { selector: ".price" }, and
{ source: "current_url" } for deterministic extraction. Use prompt to
describe relationship/fallback rules.
Relative URL-like attributes extracted from accessible iframe documents are resolved against the iframe document base URL. Main-frame extraction keeps the existing raw relative attribute behavior.
const images = await opensteer.extract({
description: 'article images with captions and credits',
prompt:
'For each image, return the image URL, alt text, caption, and credit. Prefer caption and credit from the same figure. If missing, look at sibling text, then parent/container text, then nearby alt/data-* attributes.',
schema: {
images: [
{
imageUrl: 'string',
alt: 'string',
caption: 'string',
credit: 'string',
},
],
},
})
const data = await opensteer.extract({
description: 'product-info',
schema: {
title: { element: 3 },
price: { element: 5 },
url: { source: 'current_url' },
},
})
For explicit array bindings, include multiple representative items so Opensteer can infer the repeating pattern. For semantic extraction, a single representative object shape is enough.
extractFromPlan<T>(options: ExtractFromPlanOptions): Promise<ExtractionRunResult<T>>
Extract data from a pre-built extraction plan with explicit field mappings and element paths.
Extract Options
interface ExtractOptions extends BaseActionOptions {
schema?: ExtractSchema
prompt?: string
snapshot?: SnapshotOptions
}
interface ExtractFromPlanOptions {
description?: string
schema: ExtractSchema
plan: ExtractionPlan
}
interface ExtractSchema {
[key: string]: ExtractSchemaValue
}
type ExtractSchemaValue =
| ExtractSchemaField
| string
| number
| boolean
| null
| ExtractSchema
| ExtractSchema[]
interface ExtractSchemaField {
element?: number
selector?: string
attribute?: string
source?: 'current_url'
}
Covered Features
sdk:extractsdk:extractFromPlan
