Use Stagehand act, extract, and observe primitives for precise step-controlled browser automation

domain: docs.stagehand.dev · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install the SDK: npm install @browserbasehq/stagehand (TypeScript) or pip install stagehand (Python)
  2. Instantiate Stagehand with your LLM provider config (e.g. modelName: 'claude-opus-4-5', apiKey) and call stagehand.init()
  3. Use await stagehand.page.act({ action: 'click the login button' }) to perform a natural-language action
  4. Use await stagehand.page.extract({ instruction: 'extract the product price', schema: z.object({ price: z.string() }) }) to pull typed data from the page
  5. Use await stagehand.page.observe({ instruction: 'find all clickable navigation links' }) to discover available actions before acting
  6. Close with await stagehand.close() to release the underlying browser session

Known gotchas

Related routes

Use Stagehand agent() to execute an autonomous multi-step browser task end-to-end
docs.stagehand.dev · 6 steps · unrated
Run Browser Use agent loop with a custom LLM to automate web tasks via Playwright
github.com/browser-use/browser-use · 6 steps · unrated
Deploy a Stagehand browser agent on Cloudflare Browser Run for serverless edge execution
developers.cloudflare.com/browser-run · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans