Stagehand is an SDK for browser agents in TypeScript, Python, and Go. It combines Playwright-style page and locator methods (goto, click, locator, screenshot) with three natural-language calls: act performs an action such as clicking a button, observe returns real selectors for elements described in plain words, and extract returns schema-validated data. Because observe hands back selectors, code can fill sensitive fields such as passwords without the values ever reaching the model.
When a site changes, act, observe, and extract detect it and refresh how the action runs on the page, so automations keep working after a redesign. Stagehand runs as an extension next to the browser to cut round-trip latency, and trims the accessibility tree to give the model only the page context it needs. Other agent features include WebMCP tool discovery on web pages, clipboard support, batched commands, deep locators for nested iframes and closed Shadow DOMs, and OpenTelemetry traces.
Scripts run against a local Chrome or against Browserbase cloud browsers. On Browserbase, a Model Gateway picks a model per action, server-side caching replays identical calls without spending tokens, and verified mode, residential proxies, persistent contexts, and session recordings are available. Separate Fetch and Search add-ons return page content as markdown and web search results without a browser, and a hosted Browserbase MCP server exposes navigate, act, observe, and extract to MCP clients. Integrations cover CrewAI, Mastra, Deep Agents, the Vercel AI SDK, Claude Code, and Codex.
Features
- Natural-language actions: act, observe, and extract calls alongside regular page code
- Playwright-style APIs: goto, click, locator, and screenshot methods, with a guide for migrating Playwright suites
- Self-healing: actions refresh how they run when the page changes underneath them
- Schema extraction: extract returns data validated against a Zod, Pydantic, or Go type
- Selector-based observe: returns real selectors so credentials stay out of the model's context
- Token efficiency: hybrid accessibility-tree trimming sends the model only the page context it needs
- In-browser extension: runs next to the browser to reduce latency on every action
- Agent features: WebMCP, clipboard support, batch commands, deep locators for iframes and Shadow DOM, and OTel traces
- Three languages: one browser driver across TypeScript, Python, and Go
- Browserbase: cloud browsers with a Model Gateway, action caching, proxies, persistent contexts, and session recordings
- MCP server: a hosted server that gives MCP clients navigate, act, observe, and extract tools
- Search and Fetch: web search results and page content as markdown without a browser session
