- Notifications
You must be signed in to change notification settings - Fork469
An AI web browsing framework focused on simplicity and extensibility.
License
browserbase/stagehand
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An AI web browsing framework focused on simplicity and extensibility.
Read the Docs
Stagehand is the easiest way to build browser automations. It is fully compatible withPlaywright, offering three simple AI APIs (act
,extract
, andobserve
) on top of the base PlaywrightPage
class that provide the building blocks for web automation via natural language.
Here's a sample of what you can do with Stagehand:
// Keep your existing Playwright code unchangedawaitpage.goto("https://docs.stagehand.dev");// Stagehand AI: Act on the pageawaitpage.act("click on the 'Quickstart'");// Stagehand AI: Extract data from the pageconst{ description}=awaitpage.extract({instruction:"extract the description of the page",schema:z.object({description:z.string(),}),});
Warning
We highly recommend using the Node.js runtime environment to run Stagehand scripts, as opposed to newer alternatives like Bun. This is solely due to the fact thatBun's runtime is not yet fully compatible with Playwright.
Stagehand adds determinism to otherwise unpredictable agents.
While there's no limit to what you could instruct Stagehand to do, our primitives allow you to control how much you want to leave to an AI. It works best when your code is a sequence of atomic actions. Instead of writing a single script for a single website, Stagehand allows you to write durable, self-healing, and repeatable web automation workflows that actually work.
Note
Stagehand
is currently available as an early release, and we're actively seeking feedback from the community. Please join ourSlack community to stay updated on the latest developments and provide feedback.
Visitdocs.stagehand.dev to view the full documentation.
To create a new Stagehand project configured to our default settings, run:
npx create-browser-app --example quickstart
Read ourQuickstart Guide in the docs for more information.
You can also add Stagehand to an existing Typescript project by running:
npm install @browserbasehq/stagehand zodnpx playwright install# if running locally
git clone https://github.com/browserbase/stagehand.gitcd stagehandnpm installnpx playwright installnpm run buildnpm run example# run the blank script at ./examples/example.ts
Stagehand is best when you have an API key for an LLM provider and Browserbase credentials. To add these to your project, run:
cp .env.example .envnano .env# Edit the .env file to add API keys
Note
We highly value contributions to Stagehand! For questions or support, please join ourSlack community.
At a high level, we're focused on improving reliability, speed, and cost in that order of priority. If you're interested in contributing, we strongly recommend reaching out toAnirudh Kamath orPaul Klein in ourSlack community before starting to ensure that your contribution aligns with our goals.
For more information, please see ourContributing Guide.
This project heavily relies onPlaywright as a resilient backbone to automate the web. It also would not be possible without the awesome techniques and discoveries made bytarsier, andfuji-web.
We'd like to thank the following people for their contributions to Stagehand:
- Jeremy Press wrote the original MVP of Stagehand and continues to be an ally to the project.
- Navid Pour is heavily responsible for the current architecture of Stagehand and the
act
API. - Sean McGuire is a major contributor to the project and has been a great help with improving the
extract
API and getting evals to a high level. - Filip Michalsky has been doing a lot of work on building out integrations likeLangchain andClaude MCP, generally improving the repository, and unblocking users.
- Sameel Arif is a major contributor to the project, especially around improving the developer experience.
Licensed under the MIT License.
Copyright 2025 Browserbase, Inc.
About
An AI web browsing framework focused on simplicity and extensibility.