Code librariesReviewed · browserbase

Stagehand: SDK for AI browser agents

Stagehand is an open-source (MIT) software development kit for developers who want to control a web browser with plain-English instructions from TypeScript, Python or Go. It offers Playwright-style page methods plus three AI calls (act, observe, extract), an optional hosted MCP server, a local browse command-line tool, and web search and fetch add-ons. The README's examples of the AI features use an OpenAI API key for local runs or a Browserbase API key for the vendor's cloud. The README does not give prices or free allowances, and it does not list all supported model configurations. None of it has been run or tested.

Researched 13 Nov 2026

In short.

Stagehand is an open-source SDK from Browserbase for developers who want an AI model to operate a web browser. The README, captured at revision 58a6cc14954503c96aba979ca76bcc0ecdf04bbf, describes Playwright-style methods such as goto, click and locator, plus three natural-language methods. act does something on the page. observe finds elements and returns real selectors. extract pulls data from the page: the TypeScript and Python examples describe the result as schema-validated, while the Go example says the data is decoded into a Go type. Stagehand ships in TypeScript, Python and Go and can run against a local Chrome or on Browserbase. It also offers a hosted MCP server, a browse command-line tool for coding agents, and search and fetch add-ons. The README's local examples pass an OpenAI model name and OPENAI_API_KEY. Its cloud, search, fetch and hosted MCP examples use BROWSERBASE_API_KEY. Prices, free allowances and other supported model configurations are not stated and are unknown. The licence is MIT. The speed, reliability and token-saving claims are the vendor's own statements in the README. No code was run and no benchmark was checked.

Researched and written by an AI model and checked by a second AI model. How it works

The selected scope was the single file README.md at [https://github.com/browserbase/stagehand/blob/main/README.md], read at revision 58a6cc14954503c96aba979ca76bcc0ecdf04bbf (18,244 bytes), plus the root LICENSE file at the same revision as the licence notice beside it. Everything else in the repository and every linked page was out of scope and was not read, including the docs, the Python and Go SDK READMEs, the CLI README, CONTRIBUTING.md, and Browserbase documentation and pricing. The SDK, CLI, hosted MCP server, Model Gateway, caching, search and fetch were not run or tested. The performance and reliability claims are the vendor's own and are unverified. What data the AI methods send to model providers is inferred, not documented.

The overview

What this resource is

Stagehand's README calls it the SDK for browser agents. Browserbase Inc. publishes it in the browserbase/stagehand repository on GitHub. The README says the project is a TypeScript, Python and Go monorepo and that it is MIT licensed. It also says Stagehand is a trademark of Browserbase, Inc.

This page covers the README file at [https://github.com/browserbase/stagehand/blob/main/README.md] at revision 58a6cc14954503c96aba979ca76bcc0ecdf04bbf, together with the root LICENSE file at the same revision. The README describes the project; it is not the source code, so how the library is built internally cannot be read from it.

Besides the SDK you install and call from your own program, the README mentions related parts: a hosted MCP server, a browse command-line tool and skill, and search and fetch helpers. The README describes these only briefly, so details about them are limited.

Overall assessment

Based on the captured files, Stagehand is a real, documented and actively presented developer library with a clear purpose: letting code drive a browser through a mix of ordinary Playwright-style calls and instructions interpreted by AI. The README gives working-looking examples in three languages, install commands, and links to quickstart and reference documentation.

The strongest points in the README are the familiar method names, the schema-validated extraction shown in the TypeScript and Python examples, an observe step that returns real selectors so you can fill in credentials yourself, and the choice between a local browser and the vendor's cloud. The README also says the project is built in the open, asks for bug reports and contributions, and has a Discord community.

The weaker point is that the README is as much a product page as technical documentation. The README claims 2x faster execution but provides no supporting benchmark data or methodology. Its token-efficiency and self-healing claims are also the vendor's own statements, with no supporting data in the captured file. Browserbase pricing is not given, and nothing here shows how accurate the AI actions are on real sites. Treat it as a promising, well-presented option, and try it on a small, low-risk task before relying on it.

Who it is for

Developers who write TypeScript, Python or Go and need to automate or read websites that change often or have no usable API. The README's own example signs in to a web app, opens a billing page and pulls a table of invoices into typed data. The README also presents it as a tool for building agents and lists integrations with Mastra, Deep Agents, the Vercel AI SDK, Claude Code and Codex.

Teams that already use Playwright are a named audience. The README links a guide for migrating an existing Playwright suite and says the method names (goto, click, locator, screenshot) follow the same style.

People who use a coding agent such as Claude Code, Cursor or Codex can use the browse CLI and skill instead of writing SDK code. The README says this route needs no LLM key or Browserbase account for local use.

It is probably not a fit for someone who wants a no-code tool. Every route shown in the README involves a terminal, a package manager or an MCP client configuration.

What it can do

According to the README, the core API has three AI methods. act takes a natural-language instruction, such as click the sign in button, and carries it out. observe finds elements from a description and returns selectors. extract takes an instruction and a data shape and returns the data. In TypeScript the example passes a Zod schema, and in Python a Pydantic model; the README describes both as returning schema-validated data. The Go example passes a struct type to a generic Extract function, and the README says it returns data decoded into a Go type. The README does not say whether Go applies equivalent runtime validation, so that is unknown. Ordinary page and locator methods (goto, click, locator, screenshot) sit alongside the AI methods.

The README lists these other features: accessibility-tree trimming to reduce tokens; an extension that runs next to the browser to cut round-trip time; self-healing of actions when a site changes; WebMCP, which finds and calls tools that web pages expose; clipboard support; batch commands; deep locators for nested iframes and closed Shadow DOMs; and OpenTelemetry traces.

On Browserbase, the README says you also get a Model Gateway (so you do not wire up a model provider), server-side caching of repeated actions, Verified mode, residential proxies, persistent contexts and session recordings. It links to Browserbase documentation for these but does not describe them in detail.

Outside the browser, Fetch returns a page's content as markdown and Search returns web search results. The examples for both use a Browserbase API key. A hosted MCP server exposes navigate, act, observe and extract to MCP clients. None of these claims has been checked.

Using it

What you need

For the SDK, the README gives one install route per language. For TypeScript, the documented route is pnpm add for the @browserbasehq/stagehand package, with Zod pinned to ~4.4.3. The README does not say whether other package managers work or which JavaScript runtime is required. For Python, the runtime is Python itself, and the package is installed with pip, Python's package installer. For Go, the README uses go get, which needs a Go toolchain. Minimum runtime versions for TypeScript, Python and Go are not stated, so they are unknown from this evidence.

For local runs, the README says Chrome must be installed. Its local examples set up the AI methods with the model name openai/gpt-5.4-mini and an OPENAI_API_KEY environment variable. The README does not say whether the AI methods can run locally without a model key, or which other providers or model configurations are supported, so both are unknown. It links to a model configuration page, which was not captured.

For cloud runs, the README's examples use a Browserbase API key. The README says that with the Model Gateway you do not configure a model yourself.

For the hosted MCP server, the README says you need a Browserbase API key and an MCP client such as Claude Code, Cursor or Codex.

For the browse CLI, you use npm to install the browse package globally. The README says local use needs no LLM key or Browserbase account.

To contribute or build from source, you need git, the just task runner and the toolchain for each language. The README's example run also sets an OPENAI_API_KEY.

How it works

The README describes Stagehand as a driver layered over a browser. Your program first launches a browser: either local Chrome through localBrowser or a Browserbase session through browserbase. It then creates a Stagehand object tied to that browser, with an optional model configuration.

The README says hybrid accessibility-tree trimming gives agents exactly the page context they need and nothing more, and that act, observe and extract work from natural-language instructions. It is an inference, not a statement in the README, that these calls send some form of page context and your instruction to the configured model provider or, on Browserbase, to the Model Gateway. What content is sent, where it is routed and whether credentials could be exposed are all unknown from this evidence.

On credentials, a comment in the README's selector-based login example says observe returns real selectors, so credentials never reach the model. In that example, the email and password are read from environment variables and typed with ordinary locator fill calls, not passed through act. This describes one usage pattern in the README and is not a verified privacy guarantee. The README does not describe how other usage patterns handle sensitive values.

The README says Stagehand runs as an extension next to the browser to reduce latency. It also says act, observe and extract refresh how an action happens when a site changes, which it calls self-healing. The captured file does not explain how self-healing or the server-side cache decide what to reuse, so those details are unknown. The README calls Stagehand one browser driver across three languages, but it does not say how the language SDKs relate internally, for example whether Python and Go call a common service.

Setup

The README gives these install commands. For TypeScript: pnpm add @browserbasehq/stagehand 'zod@~4.4.3'. For Python: pip install stagehand. For Go: go get with the Stagehand Go module path at version v4.0.0; the module path is [github.com/browserbase/stagehand/packages/sdk-go/v4]. The README says local runs need Chrome and points to a quickstart at [https://docs.stagehand.dev/v4/first-steps/quickstart], which it says takes you from an empty directory to working automation in three steps.

To use a coding agent instead, the README gives these steps. Run npm install -g browse, then npx skills add browserbase/stagehand --skill browse. Next, run browse open with an address and the --local flag (the README's example address is [https://example.com]), followed by browse snapshot and browse get title.

To use the hosted MCP server in Claude Code, the README gives a claude mcp add command with --transport http, the server name browserbase, the server address [https://mcp.browserbase.com/mcp] and an Authorization bearer header built from your Browserbase API key. Cursor, Codex and other clients use a JSON block with the same address and header. Keep that key out of files you commit.

To build from source, clone the repository and run just install, just generate and just build. The README's example run sets an OpenAI key and then runs just example act. None of these steps has been run.

Worked examples from the README

None of the README's examples has been run. The main example launches a local browser with a userDataDir of ./browser-data so cookies persist between runs, creates Stagehand with an OpenAI model, and opens a login page at the placeholder address [https://app.example.com/login]. It calls observe to find the email and password inputs, then fills them from environment variables with normal Playwright-style locator calls. Next, act clicks the sign in button and opens the billing page. extract then uses a Zod schema to return invoice data (number, amount, paid), which the README describes as schema-validated. Finally, the example closes Stagehand and the browser. As written, this example uses Chrome installed locally, an OPENAI_API_KEY for the model, and APP_EMAIL and APP_PASSWORD environment variables holding login credentials for the site being automated. The login credentials are needed only because this example signs in to an app.

The same flow is given in Python, using Pydantic models, and in Go, using a generic Extract function and struct types; the README says the Go version decodes the data into a Go type. These versions use the same OpenAI key and login environment variables as the TypeScript version.

A second example swaps the local browser for browserbase.launch, leaves out the model configuration so the Model Gateway chooses, and sets cache to true. This example uses a BROWSERBASE_API_KEY and, according to the README, no model key or model configuration.

A third example calls browserbase.search with a query and a number of results, then calls browserbase.fetch on the first result's address in markdown format. This example uses a BROWSERBASE_API_KEY; it does not open a browser session or use login credentials.

For coding agents, the README's browse CLI example installs the browse package and skill, then runs browse open on [https://example.com] with the --local flag, followed by browse snapshot and browse get title. The README says local use of this route needs no LLM key or Browserbase account. How any of these examples behave on real sites is unknown.

Assessment & evidence

Limitations and risks

Nothing was run, so there is no evidence here about reliability, accuracy, speed or how the library behaves on real sites. The claims that it is 2x faster than Playwright cloud equivalents, self-healing and token efficient come from the vendor, with no method or data in the captured file.

The captured README does not describe how accurate act, observe and extract are, how often they fail, or any guardrails, confirmation steps or protections against hostile or misleading page content. Stagehand's protections in these areas are therefore unknown. As a precaution, consider reviewing or confirming any action that changes data, spends money or sends messages, and point it only at sites you trust and are allowed to automate.

On privacy, the README's selector-based example says credentials never reach the model, but that statement covers that example and is not a verified guarantee. It is an inference, not a README statement, that act and extract send some page content to a model provider or to Browserbase's Model Gateway. What content is sent, where it is routed and whether credentials could be exposed are unknown. As a precaution, avoid using it on pages that hold data you are not allowed to share. The README says cookies persist in ./browser-data so the next run starts already signed in, so protect that folder and keep it out of version control.

Some features, including Verified mode, residential proxies and the Model Gateway, depend on Browserbase and are described only by links. Check whether automating a given site is allowed under that site's terms. The README links the Go SDK guide on a branch called v4-go, so it is unknown how mature or stable the Go SDK is compared with the others.

Why consider it, and the tradeoffs

The README gives several reasons to consider Stagehand. It pairs Playwright-style page and locator methods with natural-language act, observe and extract calls. It shows the same login-and-extract example in TypeScript, Python and Go, and it runs against either a local Chrome or a Browserbase session. Its selector-based login example shows how to type sensitive values with ordinary locator calls instead of passing them through the model. Extraction results are described as schema-validated in TypeScript and Python and as decoded into a Go type in Go.

The README also shows tradeoffs. Its local AI examples use an OpenAI model and API key. The Model Gateway, server-side caching, Verified mode, residential proxies, session recordings, Search, Fetch and the hosted MCP server are tied to a Browserbase API key. No prices or free allowances are given for either. The speed, token-efficiency and self-healing benefits are vendor claims without supporting data in the captured file. The MIT LICENSE matches the README's licence statement, which settles the code licence but not the terms of the hosted services.

The README offers three entry points: the SDK, the browse CLI and skill, and the hosted MCP server. It links a page on when to use each. It shows different operations for each route: the hosted MCP server lists navigate, act, observe and extract, while the CLI example shows open, snapshot and get title. It does not show that they offer the same features, so check that the route you choose covers what you need.

Alternatives

The README compares Stagehand with Playwright in two ways. It says its page methods are Playwright-style (goto, click, locator, screenshot), and it claims 2x faster execution on Browserbase than Playwright cloud equivalent browsers. It also links a guide for porting an existing Playwright suite at [https://docs.stagehand.dev/v4/migrations/playwright], which was not captured. The README does not say when plain Playwright would be the better choice.

The README also lists integrations (Mastra, Deep Agents, the Vercel AI SDK, Claude Code, Codex) and offers a choice between the SDK, the browse CLI and the hosted MCP server. For some uses, one of Stagehand's other routes may be a better fit. It links a page on choosing between them at [https://docs.stagehand.dev/v4/first-steps/choosing-your-path], which was not captured.

Other browser-agent frameworks and hosted browser services exist. The evidence does not compare them, so no ranking is offered.

Evidence used

This analysis is based on two files from the browserbase/stagehand repository at revision 58a6cc14954503c96aba979ca76bcc0ecdf04bbf: the project README.md, which describes the SDK, its examples, install routes and related Browserbase services, and the root LICENSE file, which contains the MIT licence text.

The README links to documentation, a Python SDK README, a Go SDK README, a CLI README, CONTRIBUTING.md and Browserbase pages. The contents of those linked pages are not covered here. Source code, tests, release notes, issues and benchmarks are also not covered, and nothing described in the README was run or tested.

Access & freshness

Costs

The MIT LICENSE grants its permissions free of charge, so there is no licence fee for the code. The README does not state any price for the SDK.

The README's local examples set up the AI methods with an OpenAI model name and OPENAI_API_KEY. It does not say what that provider charges, whether a free allowance applies or which other model configurations are supported, so the running cost per action is unknown. It claims that trimmed page context saves tokens and that, with server-side caching, identical calls come back from Browserbase with no tokens spent, but gives no figures.

The README's examples for running on Browserbase, Search, Fetch and the hosted MCP server use a Browserbase API key. It presents the Model Gateway, caching, proxies and session recordings as part of Browserbase. It gives no Browserbase plans, limits, free allowances or prices, so those costs are unknown from this evidence. It says the Model Gateway picks the cheapest model for each action but does not say how Browserbase charges for that.

The README says local use of the browse CLI needs no LLM key or Browserbase account. According to the README, local SDK runs need Chrome installed. It does not say whether the AI methods can run locally without a model key.

Licence and rights

The LICENSE file at the captured revision is the standard MIT licence, copyright 2024 Browserbase Inc. It allows use, copying, modification, merging, publishing, distribution, sublicensing and sale, as long as the copyright and permission notice are kept in all copies or substantial portions. The software is provided as is, without warranty.

The README says the project is licensed under the MIT License and shows a copyright line of 2026 Browserbase, Inc., while the LICENSE file says 2024. This small inconsistency between the files does not change the MIT terms. The README also states that Stagehand is a trademark of Browserbase, Inc., so the MIT licence on the code should not be read as permission to use the name or logo.

Only the root LICENSE was captured. It is not shown whether the Python and Go packages inside the monorepo have separate licence files. The terms for Browserbase's hosted services (cloud browsers, Model Gateway, MCP server, Search and Fetch) are separate from the MIT licence and were not captured. The licences of third-party dependencies and of the model providers you choose were not assessed.

Freshness

The content was captured on 2026-11-13 at revision 58a6cc14954503c96aba979ca76bcc0ecdf04bbf. The README refers to a v4 documentation line, a Go install pinned at v4.0.0, a 2026 copyright and recent-looking model names such as openai/gpt-5.4-mini, which suggests it was written recently. The captured evidence has no commit dates, release dates or changelog, so it is unknown how often the project is updated or when the latest release came out.

Much of what the README describes is likely to change, including model names, Browserbase features and documentation addresses. Check the current quickstart and the version you install before relying on the examples.

Suggested next steps

To try it, start with the quickstart at [https://docs.stagehand.dev/v4/first-steps/quickstart] in a throwaway project, using a site you own or are allowed to automate. If your model provider supports spending limits, set a low one. Watch how many model calls and tokens a simple flow uses before scaling up.

If you plan to use Browserbase, read its pricing and terms first, since the README gives neither. Keep API keys in environment variables or a secrets manager, and do not commit the browser-data folder.

Pin the package versions you test with. Add your own checks on extracted data; the TypeScript and Python schemas help with this, and in Go you may need explicit checks. Consider adding human confirmation before any action with side effects.

If you only need a coding agent, try the local browse CLI route first. The README says it needs no LLM key or Browserbase account.

Evidence for this report

LICENSEnotice · checked 2026-11-13
README.mdselected · checked 2026-11-13