Skip to content

Stagehand

TypeScript, Python and Go SDK for letting AI control a web browser to act on and extract data from sites.

Stars
25.9k
Forks
1.8k
Licence
MIT
Language
TypeScript
Last update
7 days ago
Type
Library

What it is

Stagehand is an SDK that lets code drive a real web browser using plain-language instructions alongside Playwright-style methods. You can ask it to observe elements, act on a page (such as clicking a button), or extract data into a schema you define. Sessions such as login cookies can persist between runs.

  • Log into a web app and keep the session for later runs
  • Extract every row of an invoice table into validated data
  • Click through a site's navigation to reach a specific page
  • Locate form inputs and fill them with values from environment variables

Great for

  • Developers building browser agents that must work on sites they do not control
  • Teams extracting structured data from web pages that lack an API
  • Engineers who already know Playwright and want AI-assisted steps
  • Projects needing TypeScript, Python or Go bindings of the same workflow

Not ideal for

  • People who only need fixed scripted browser tests with no AI, since the README centers on model-driven steps
  • Non-programmers, because the examples require writing code and an API key for a model provider
  • Users without Chrome installed for local runs, since the README says local runs need it
Step-by-step guide: how to use StagehandInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js (for the TypeScript package) · Python (for the Python package) · Go (for the Go module) · Google Chrome for local browser runs · An API key for a supported model provider such as OpenAI

    Install TypeScript package

    pnpm add @browserbasehq/stagehand 'zod@~4.4.3'

    Install Python package

    pip install stagehand

    Install Go module

    go get github.com/browserbase/stagehand/packages/sdk-go/v4@v4.0.0
  2. 2

    Run it

    • Install Chrome and the SDK for your language
    • Set OPENAI_API_KEY in your environment
    • Copy the TypeScript or Python example from the README
    • Run it and check that the extracted data is printed
  3. 3

    Get the most out of it

    • Use a persistent userDataDir so later runs start already signed in
    • Use observe() to get selectors before filling forms, keeping credentials out of model prompts
    • Pass a zod or pydantic schema to extract() to get typed results
    • Read the docs at docs.stagehand.dev for the full quickstart

Downloads

Strengths

  • Familiar Playwright-style API for developers already using it
  • Returns schema-validated data from extract() calls
  • Available in TypeScript, Python and Go with MIT license

Trade-offs

  • Relies on a third-party model provider and its API key, so usage has external cost and data flow
  • README is truncated, so full feature and configuration details could not be verified here
  • Model-driven actions can behave differently across sites and runs

How it compares

ProjectStarsTypeLevelUpdatedBest for
stagehand (this)25.9kLibraryintermediate7 days agoDevelopers building browser agents that must work on sites they do not control
browser-use120kLibraryintermediate5 days agoPython developers who want to prototype an AI agent that operates websites
browser-harness18.8kDev toolbeginner4 days agoDevelopers who already use Claude Code, Codex or Cursor and want the agent to act in their own logged-in Chrome
CloakBrowser32.7kLibrarybeginner5 days agoPython or JavaScript developers already using Playwright who need automation to get past bot checks
invisible_dots32.4kAI model / agentintermediate6 days agoDevelopers who want a self-hosted agent and are comfortable with a command-line setup
pinchtab10.5kDev toolintermediate10 days agoDevelopers building AI agents that need to browse and extract page content

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.