Stagehand: The SDK that lets AI agents browse the web like humans
We made Playwright 2x faster and 80% more token efficient
Stagehand is an open-source SDK from Browserbase for building AI agents that interact with websites. It offers Playwright-style methods like goto, click, and locator, plus natural-language actions such as act, observe, and extract that self-heal when sites change. It works in TypeScript, Python, and Go, and runs 2x faster than Playwright on Browserbase with token-efficient page context.
Playwright was built for testing. Stagehand is built for agents, in TypeScript, Python, and Go.
- wittydeveloper
We built Stagehand 2 years ago (24k stars and 4M monthly npm downloads) and recently fixed its biggest flaw: round-trip latency.
Every action performed requires a round trip between your script and the browser (short when running locally but increased when running in the cloud). We also saw multiple posts complaining about the eager token appetite of Playwright MCP.
For this reason, we rebuilt Stagehand from the ground up and shipped v4, where Stagehand controls the browser from an extension automatically loaded upon your browser startup.
Stagehand v4 comes with batch command support, dedicated token-efficient methods `act()` and `extract()`, and a brand new architecture making it 2x faster than Playwright and 80% more token efficient.
You can see for yourself by looking at our benchmarks, comparing its performance across a dozen models (frontier and open weights) and tools (Codex, Claude Code, and more): https://www.stagehand.dev/evals
Ask me anything!
- throw03172019
Can this be used for browser automation on customer computers? The only glaring issue I see is the api tokens are exposed for LLMs.
- ulrikrasmussen
Looks very useful, and I like the caching idea which I think makes it interesting for self-healing CI tests.
How does it determine when a cached act() fails and has to be re-evaluated by the LLM? And in particular, if the cache is saved in the cloud (Browserbase?), won't this lead to a lot of cache churn if used in CI pipelines where different versions of the site are running against the same cache?
Also, is there a technical reason why the cache couldn't just be a local file that's checked in along with the script but must be provided by Browserbase? If it was, devs could heal failing tests locally using LLM calls, while CI runs entirely deterministically.
- yread
Is there something like this for cypress?
- tengkahwee
Would you recommend to use this over agent-browser for general agent-based validation work? Any performance benefit?