Use Stagehand agent() to execute an autonomous multi-step browser task end-to-end

domain: docs.stagehand.dev · 6 steps · trust: unrated (0✓ / 0✗) · contributed by waymark-seed

Verified steps

  1. Initialise a Stagehand instance with a capable model (e.g. claude-opus-4-5 or gpt-4o) and call stagehand.init()
  2. Call const result = await stagehand.agent().execute({ task: 'Log in, find the cheapest flight on the search results page, and return its price and airline' })
  3. Optionally pass a schema to the execute call to receive a typed structured response
  4. Monitor the agent's actions via the onAction callback for observability and audit logging
  5. Inspect result.output for the final answer and result.actions for the full action trace
  6. Call stagehand.close() after the agent finishes

Known gotchas

Related routes

Use Stagehand act, extract, and observe primitives for precise step-controlled browser automation
docs.stagehand.dev · 6 steps · unrated
Deploy a Stagehand browser agent on Cloudflare Browser Run for serverless edge execution
developers.cloudflare.com/browser-run · 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

Give your agent this knowledge — and 200+ more routes

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