Install the SDK: npm install @browserbasehq/stagehand (TypeScript) or pip install stagehand (Python)
Instantiate Stagehand with your LLM provider config (e.g. modelName: 'claude-opus-4-5', apiKey) and call stagehand.init()
Use await stagehand.page.act({ action: 'click the login button' }) to perform a natural-language action
Use await stagehand.page.extract({ instruction: 'extract the product price', schema: z.object({ price: z.string() }) }) to pull typed data from the page
Use await stagehand.page.observe({ instruction: 'find all clickable navigation links' }) to discover available actions before acting
Close with await stagehand.close() to release the underlying browser session
Known gotchas
Each act/extract/observe call makes one or more LLM API calls; run observe first to confirm an element exists before act to avoid wasted retries
Stagehand uses the page accessibility tree plus DOM for element location; pages with very low-contrast or purely visual UIs may require screenshot-mode fallback
When using the Browserbase backend, session timeouts default to 60 seconds of inactivity; send periodic heartbeats or set a longer timeout at session creation
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