Stagehand
Quick Take
Stagehand is Browserbase’s open-source SDK for browser agents: a framework that lets you write browser automation using natural-language actions, deterministic code, or a mix of both in the same script. Version 4, released in August 2026, adds a browser-extension execution mode, self-healing actions, and result caching, with Browserbase reporting it runs roughly twice as fast as Playwright while using around 80% fewer tokens.
What Stagehand Does
Stagehand exposes a small set of core actions for controlling a browser with AI assistance:
act(): perform an action described in natural language, like “click the submit button” or “fill in the search box with ‘AI tools’”observe(): ask the model what actions are available on the current page before deciding what to doextract(): pull structured data out of a page using a described shape rather than manual selector-writing
The key idea is that you don’t have to choose between full AI autonomy and traditional, brittle selector-based scripts. You can write exact Playwright-style code for the stable, well-understood parts of a flow, and drop into natural-language act() calls for the parts that are more dynamic or where writing a precise selector would be fragile.
What’s New in v4
- Browser-extension mode: Stagehand now runs its logic inside the browser as an extension, bringing the “local” execution experience to remote browsers too, which lowers round-trip time and reduces potential race conditions with the Chrome DevTools Protocol
- Self-healing actions: automations adapt when a page’s layout changes, instead of breaking outright
- Improved iframe support and better context management overall
- Caching for
act(),observe(), andextract(): once identical results are seen enough times (a configurable hit-count threshold), Stagehand serves the cached result and skips a fresh model call entirely, cutting both latency and cost on repeated runs
Key Facts
- Developer: Browserbase
- License: MIT, fully open-source
- v4 released: August 2026
- Model support: OpenAI, Anthropic, and Google Gemini, via the Vercel AI SDK; Browserbase’s Model Gateway lets you access all supported models through a single Browserbase API key at the same price as going direct to the provider
- Performance (Browserbase’s benchmarks): roughly 2x faster than Playwright, about 80% more token-efficient
- Ecosystem: partnered with Vercel, Mastra, CrewAI, and LangChain on browser-agent templates and integration guides
Where Stagehand Fits in Ainanza’s Browser-Agent Cluster
Stagehand sits at the developer-framework layer of browser automation, alongside Browser Use, which offers a similar open-source, model-agnostic approach but without Stagehand’s specific code-plus-natural-language blending. It’s a different layer than Cloudflare Kitesurf, which is a lightweight browser runtime rather than agent logic, and different again from full computer-use agents, which control an entire desktop rather than scripting inside a browser session. Traditional Playwright automation, which Stagehand is commonly benchmarked against, requires hand-written selectors for every interaction and breaks when a page’s layout changes; Stagehand’s natural-language actions and self-healing behavior are built specifically to reduce that fragility.
Honest Limitations
- Requires programming knowledge. Like Browser Use, this is a developer SDK, not a no-code tool.
- Model API costs still apply. The SDK is free, but every
act(),observe(), orextract()call (when not served from cache) uses a paid model call. - Reliability depends partly on the underlying model. Natural-language actions are only as good as the model interpreting the page and deciding what to do.
- Newest features are, well, new. v4’s extension mode and caching are recent additions; expect some rough edges as they mature in production use.
Alternatives Worth Knowing
- Browser Use, an open-source, model-agnostic framework with a similar goal, without Stagehand’s code-plus-natural-language blend
- Cloudflare Kitesurf, a lightweight browser runtime rather than agent logic, a different layer of the same stack
- BrowserOS neo, a local, open-source browser built specifically for AI agents to drive
- BrowserAct, browser automation aimed at less technical users
- Cua, computer-use agent infrastructure that controls a full desktop, not just a browser
For the concept behind all of these, see the browser agent glossary entry, and see Cloudflare Kitesurf vs Browser Use for how the runtime-versus-framework distinction plays out in practice.
Continue learning
Explore related guides, tools, workflows, and prompts that help you go deeper into this topic.
See how this tool fits into a workflow
Browse step-by-step AI workflows that use ChatGPT, Claude, Gemini, and other tools.
Frequently Asked Questions
What is Stagehand?
Stagehand is an open-source SDK from Browserbase for building browser agents. It lets you mix natural-language actions, like "click the login button", with precise, deterministic code in the same script, so you don't have to choose between full AI flexibility and reliable, repeatable automation.
What's new in Stagehand v4?
Version 4 adds a browser-extension mode so Stagehand can run its logic inside the browser itself rather than only round-tripping every action to a remote process, which lowers latency and reduces race conditions with the Chrome DevTools Protocol. It also adds self-healing actions, improved iframe support, and caching for act(), observe(), and extract() calls, so identical repeated actions can skip inference entirely.
Is Stagehand free?
The SDK itself is free and open-source under the MIT license. You still pay for the AI model calls it makes (OpenAI, Anthropic, or Google, depending on what you configure) and, if you use Browserbase's hosted browser infrastructure instead of running your own, for that hosting.
How is Stagehand different from Browser Use?
Both are open-source frameworks for building AI-driven browser agents, and the two are commonly compared directly. Stagehand's distinguishing feature is that it lets you blend natural-language actions with exact, code-level browser commands in the same script, rather than handing over full control to the AI for every step, which tends to make it more predictable for tasks where part of the flow is stable and well-known.
Last updated: