Stagehand: A Browser Agent SDK That Sits Between Playwright and Full Autonomy
Project brief: The SDK For Browser Agents. Most existing browser automation tools either require you to write low-level code in a framework like Selenium, Playwright, or Puppeteer, or use high-level agents that can be unpredictable in production.
At a glance
- What is it?
- Stagehand is a TypeScript, Python, and Go SDK from Browserbase that wraps Playwright-style APIs with natural language actions like act, observe, and extract. It targets production browser agents, not test scripts, and its self-healing primitives trade some determinism for adaptability.
- Who is it for?
- Adopt Stagehand if you are building browser agents that must survive website changes and you already accept the cost of an LLM provider. Do not use it if you need fully deterministic automation or want to avoid model API dependencies.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.
Star history
- browserbase/stagehand26,037 ★ · +2,345
| Repository | 2026-07-31 | 2026-11-13 |
|---|---|---|
| browserbase/stagehand | 23.7k | 26k |
2,345 Stars in the last 105 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What Stagehand Actually Solves
Stagehand targets a specific gap in browser automation. Tools like Selenium, Playwright, and Puppeteer force you to write low-level selectors and step-by-step scripts. High-level agents, on the other hand, are often unpredictable in production. Stagehand tries to occupy the middle: it gives you Playwright-style methods such as goto, click, locator, and screenshot, but adds natural language primitives that can adapt when a page changes. The intended user is a developer building a browser agent that must run reliably against real websites, not a QA engineer writing a stable test suite. The README is explicit about this: Playwright was built for testing, Stagehand is built for agents.
The Core Mechanism: Self-Healing Primitives and Hybrid Accessibility Trees
Stagehand's architecture is visible in three features. First, it offers three natural language actions: act, observe, and extract. These let an agent describe what to do on a page rather than hard-code a selector. When a site changes, Stagehand detects the change and refreshes how the action happens. That is the self-healing part. Second, the SDK uses hybrid accessibility tree trimming to give the model only the page context it needs. The README says this reduces token usage, which matters when every action is billed by an LLM provider. Third, Stagehand runs as an extension next to the browser. The README claims this cuts round-trip latency on every action. The combination is a design that prioritizes token efficiency and adaptability over the strict determinism of a traditional automation framework.
Getting Started: Commands and Configuration
The README shows a minimal TypeScript example. You import localBrowser and Stagehand from @browserbasehq/stagehand, plus zod for schema validation. The browser is launched via localBrowser.launch with a userDataDir so cookies persist, then Stagehand.create takes the browser and a model config that names a specific model, such as openai/gpt-5.4-mini, with an OPENAI_API_KEY. A separate Browserbase variant launches via browserbase.launch with BROWSERBASE_API_KEY and needs no model configuration. The example then gets a page from browser.context.pages() and calls page.goto. No explicit selector is needed for the natural language actions. To build from source, the repository is a monorepo with TypeScript, Python, and Go packages. The build process uses just to drive pnpm, uv, and go. The commands are: git clone, cd stagehand, just install, just generate, just build. After exporting the API keys, you can run example scripts with just example act, which runs packages/sdk-ts/examples/act.ts.
Where Stagehand Is the Wrong Tool
Stagehand is not a drop-in replacement for Playwright in a test suite. Its self-healing actions are inherently probabilistic because they depend on an LLM. A test that must pass identically every time cannot tolerate a model occasionally choosing a different route to the same element. The README does not promise deterministic behavior; it promises reliability through recovery. Another limitation is the dependency on external services. The quickstart requires an LLM API key, and local runs need Chrome installed; Browserbase is an optional cloud target. That means your automation runtime is tied to a model provider. If it has an outage or a rate limit, your agents stop.
Alternatives: Playwright and Traditional Agent Frameworks
The most direct alternative is plain Playwright. Playwright gives you the same low-level APIs that Stagehand wraps, but without the natural language layer. You write selectors yourself, which is more work but fully deterministic. Playwright also has no built-in token economy because it does not talk to an LLM. The trade-off is clear: you give up adaptability for control. On the other end, you have high-level agent frameworks that take a goal and browse autonomously. Those are often unpredictable in production, which is exactly the problem Stagehand names. Stagehand sits in between by letting you keep the deterministic control of Playwright for navigation and then use act, observe, and extract for the parts that change. If you already have a working Playwright setup and your selectors are stable, you likely do not need Stagehand. If your pages change often, Stagehand's self-healing approach is the differentiator.
Maintenance and Upgrade Cost
The repository is active. The last push was 2026-11-02, and there are recent releases for both the SDK and the server component. The release names show a versioning scheme: @browserbasehq/[email protected] and stagehand-server-v3/v3.7.7. That suggests the SDK and the server are versioned separately, which means you must track two components. The README and docs now point to v4: the Go install pins sdk-go/[email protected], the workspace package.json is version 4.0.0, and the quickstart link is the v4 one, while the latest tagged npm release listed is still 3.7.3. Before upgrading, you should check the changelog for breaking changes between minor versions. The license is MIT, so you can modify and redistribute freely. The project also has a CONTRIBUTING.md at the repository root.
What the README Does Not Tell You
The README's opening sections focus on examples rather than operational details such as how self-healing works internally. It lists WebMCP, clipboard support, batch commands, deep locators for nested iframes and closed Shadow DOMs, and OTel traces as agent features, and points to the docs for the Model Gateway and server-side caching. It describes the three SDKs as one complete browser driver across TypeScript, Python, and Go. For a production decision, you would want to verify that the natural language actions behave the same across all three languages. The build instructions assume you have just, pnpm, uv, and go installed, which is a heavier setup than a simple npm install.
The Bottom Line for Adopters
Stagehand is a serious attempt to make browser agents production-ready by combining the control of Playwright with the flexibility of LLM-driven actions. Its token efficiency and self-healing primitives are concrete features that address real pain points. But it is not a tool for deterministic testing, and it requires an LLM provider that you must budget for, with Browserbase as an optional paid cloud target. If you are building an agent that monitors a website that changes its markup frequently, Stagehand's approach could save you from constant selector maintenance. If you need a stable regression suite, stick with Playwright. The project is MIT licensed and actively maintained, which lowers the risk of adoption. The separate versioning of the SDK and server is a cost you will have to manage. Verify the actual API version before you start, and test how act and observe behave on your specific pages. That is the only way to know if the self-healing works for you.
Editorial conclusion
Adopt Stagehand if you are building browser agents that must survive website changes and you already accept the cost of an LLM provider. Do not use it if you need fully deterministic automation or want to avoid model API dependencies. Before committing, verify the current self-healing behavior in your own flows, check the OTel and WebMCP support against your observability and tool integration needs, and confirm that the v4 API in the README and docs matches the version you plan to deploy.
Frequently asked questions
how to use stagehand
Install the SDK for your language, launch a browser, and create a client against it with a model and a key. Local runs need Chrome installed. The API is deliberately shaped like the browser automation library you already use, with navigation, click, locator and screenshot methods, and three operations on top: act, observe and extract, where observe returns real selectors so page contents such as credentials are not sent to the model.
what is stagehand automation
It is browser automation driven by a model rather than by a script you wrote for each page. The project's stated position is that existing tools force a choice between low-level code in a familiar automation framework and high-level agents that behave unpredictably in production. The self-healing claim is that the three operations refresh how an action happens when a site changes underneath it.
what is stagehand ai
It is the SDK layer for AI agents that drive a browser, and the project describes itself as the SDK for browser agents. The agent part is the model call; the SDK part is the selector resolution, the accessibility-tree trimming that controls token use, the extension that runs next to the browser, and the three-language client surface over all of it.
Official sources
Where this project is recommended
Where developers are discussing it
Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 0 in the last 30 days; newest first.
- We made Playwright 2x faster and 80% more token efficientHacker News · Sep 18, 2026 · 155 points · 41 comments
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/browserbase-stagehand)Star history chart for your README
[](https://hysenlabs.com/projects/browserbase-stagehand)Was this useful?