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 with Playwright, offering three simple AI APIs (act, extract, and observe) on top of the base Playwright Page 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 unchangedawait page.goto("https://docs.stagehand.dev");
// Stagehand AI: Act on the pageawait page.act("click on the 'Quickstart'");
// Stagehand AI: Extract data from the pageconst { description } = await page.extract({
instruction: "extract the description of the page",
schema: z.object({
description: z.string(),
}),
});
Why?
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 our Slack community to stay updated on the latest developments and provide feedback.
git clone https://github.com/browserbase/stagehand.git
cd stagehand
npm install
npx playwright install
npm 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 .env
nano .env# Edit the .env file to add API keys
Contributing
[!NOTE]
We highly value contributions to Stagehand! For questions or support, please join our Slack 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 to Anirudh Kamath or Paul Klein in our Slack community before starting to ensure that your contribution aligns with our goals.
This project heavily relies on Playwright as a resilient backbone to automate the web. It also would not be possible without the awesome techniques and discoveries made by tarsier, and fuji-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 like Langchain and Claude MCP, generally improving the repository, and unblocking users.
Sameel Arif is a major contributor to the project, especially around improving the developer experience.
License
Licensed under the MIT License.
Copyright 2025 Browserbase, Inc.
1.10.1
Patch Changes
#422a2878d0 Thanks @miguelg719! - Fixing a build type error for async functions being called inside evaulate for observeHandler.
FAQs
An AI web browsing framework focused on simplicity and extensibility.
The npm package @browserbasehq/stagehand receives a total of 55,601 weekly downloads. As such, @browserbasehq/stagehand popularity was classified as popular.
We found that @browserbasehq/stagehand demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 3 open source maintainers collaborating on the project.
Package last updated on 21 Jan 2025
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
By Kirill Boychenko, Peter van der Zee - Jan 29, 2025