The SDK for browser agents

Stagehand is an open source SDK that uses AI to make your browser agents resilient, readable, and production-ready.

Scripts gives you precision. Agents give you flexibility. Stagehand gives you both.

Write browser agents using natural language instructions that handles real-world page changes, without handing over control to a black-box agent.

Selectors break. Natural language doesn't.

Every team running Playwright at scale knows the maintenance loop: a site updates its DOM, a selector breaks, a pipeline fails, someone gets paged.

Stagehand exits that loop. Instructions like "click the submit button" survive page redesigns because they're resolved by AI at runtime, not hardcoded into your test suite.

It's also the only open source browser AI framework built specifically for browser agents. Use it for agents that need to log in, navigate, extract, and take action on real web interfaces. Use it when there's no API. Use it when the site changes without warning.

Smarter than Selenium, safer than an agent

The first browser agent framework built for the AI era, giving you both the predictability of code and the adaptability of AI.

Comparing frameworks
FeatureLegacy frameworksStagehandBrowser agent
Core features
Can read page contentYes Yes Yes
Can interact with pageYes Yes Yes
Continues to work when the page changesNo Yes Yes
Extract data using natural languageNo Yes Yes
Framework standards
Fast, cheap, and predictableYes Yes No
UnderstandableNo Yes No
Self-healingNo Yes Yes
Open sourceNo Yes No

Stagehand + Browserbase

Start locally. Deploy to Browserbase.

Frequently Asked Questions

What is Stagehand?

Stagehand is an open source AI browser automation framework. It gives you four primitives — act, extract, observe, and agent — that let you write browser automations using natural language instructions instead of brittle CSS selectors. It's available in TypeScript and Python.

How is Stagehand different from Playwright or Selenium?

Traditional frameworks like Playwright and Selenium rely on hardcoded selectors that break whenever a site updates its DOM. Stagehand uses AI to resolve instructions like "click the submit button" at runtime, so your scripts survive page redesigns without maintenance. You still get deterministic control — Stagehand isn't a black-box agent.

Does Stagehand require Browserbase?

No. Stagehand works locally out of the box with any Chromium browser. Browserbase is optional — when you're ready for production, you can connect Stagehand to Browserbase's cloud browsers for Agent Identity, session replay, captcha solving, and zero-infrastructure deployment via Functions.

What LLM providers does Stagehand support?

Stagehand supports all major model providers — including OpenAI, Anthropic, and Google Gemini — via the Vercel AI SDK. If you're on Browserbase, you can also use Model Gateway to access every supported model through a single Browserbase API key, with no separate accounts or credentials to manage.

Is Stagehand open source?

Yes. Stagehand is fully open source under the MIT license. You can find the source code, contribute, and file issues on GitHub at github.com/browserbase/stagehand.

When should I use act/extract/observe vs agent?

Use act, extract, and observe when you want precise, step-by-step control over browser actions — they're deterministic and predictable. Use agent when you need multi-step workflows executed autonomously, like navigating a complex checkout flow. Most teams combine both: agent for exploration, individual primitives for critical paths.

Where can I get help with Stagehand?

Join the Stagehand community Discord at discord.gg/stagehand — it's the best place to ask questions, share what you're building, and get help from the team and other developers.