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 plus Browserbase credentials. Do not use it if you need fully deterministic automation or want to avoid cloud 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 September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE 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 reduces round-trip latency because the SDK is not a separate process. 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 browserbase and Stagehand from @browserbasehq/stagehand, plus zod for schema validation. You need two environment variables: BROWSERBASE_API_KEY and OPENAI_API_KEY. The browser is launched via browserbase.launch, then Stagehand.create takes the browser and a model config that names a specific model, such as openai/gpt-5.4-mini. The example then gets a page from browser.context.pages() and calls page.goto. No explicit selector is needed for the natural language actions, though the example is truncated before showing an act call. 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 both an LLM API key and Browserbase credentials. That means your automation runtime is tied to a cloud browser service and a model provider. If either has an outage or a rate limit, your agents stop. Finally, the README does not document failure modes for the natural language actions in detail. There is no mention of what happens when the model cannot find a matching element or when the accessibility tree is too sparse. You would need to test that yourself.
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-08-28, and there are recent releases for both the SDK and the server component. The release names show a versioning scheme: @browserbasehq/stagehand@3.7.3 and stagehand-server-v3/v3.7.6. That suggests the SDK and the server are versioned separately, which means you must track two components. The README uses Stagehand.create in the example, which implies the v3 API is current, but the docs link points to a v4 quickstart. That discrepancy is a warning sign: the README may lag the actual API. Before upgrading, you should check the changelog for breaking changes between minor versions. The license is MIT, so you can modify and redistribute freely. Stagehand is a trademark of Browserbase, Inc., so you cannot use that name for your own product. The project also has a contributing guide that asks you to reach out before implementing major features, which suggests the maintainers want to control the roadmap.
What the README Does Not Tell You
The README is short on operational details. It does not describe how the self-healing mechanism works under the hood, what models are supported beyond the example, or how to handle rate limits and retries. It mentions WebMCP, clipboard support, batch commands, deep locators for nested iframes, and OTel support, but gives no examples or configuration keys for any of them. If you need observability, you will have to dig into the docs or the source. The README also does not state whether the Python and Go SDKs have feature parity with TypeScript. It only says they exist and have equivalent examples. 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 external services that you must budget for. 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 plus Browserbase credentials. Do not use it if you need fully deterministic automation or want to avoid cloud 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 v3 API in the README matches the version you plan to deploy.
Community notes