Introduction
Quick Start: SDK
Get started with the TypeScript SDK.
Quick Start: SDK
import { Opensteer } from 'opensteer'
const opensteer = new Opensteer({ name: 'quickstart' })
try {
await opensteer.launch()
await opensteer.goto('https://news.ycombinator.com')
await opensteer.snapshot({ mode: 'action' })
await opensteer.click({ description: 'search-input' })
await opensteer.snapshot({ mode: 'extraction' })
const data = await opensteer.extract({
description: 'top-stories',
schema: { title: 'string', url: 'string', points: 'number' },
})
console.log(data)
} finally {
await opensteer.close()
}
Create
new Opensteer({ name }) creates an instance. The name sets the selector cache namespace — descriptions you use during interaction are persisted under .opensteer/selectors/<name> for deterministic replay.
Launch
launch() starts a browser session. Local by default (Playwright). Pass cloud: true to run remotely.
Navigate
goto(url) navigates the browser to the target URL and waits for the page to settle.
Snapshot
snapshot({ mode }) captures the current page state. Use 'action' before interactions so the framework can resolve descriptors to selectors. Use 'extraction' before pulling structured data.
Interact
click({ description }) clicks the element matching the description. The resolved selector is cached — subsequent runs replay deterministically without LLM calls.
Extract
extract({ description, schema }) returns structured data from the page matching the schema you provide. The description scopes extraction to a region of the page.
Close
close() tears down the browser session and releases resources. Always call it — wrap your workflow in try/finally.
