Skip to content
← Tools / Skills
ToolBrowserbase/10 trustVerified
Stagehand logo

Stagehand

AI browser automation SDK: natural-language actions on top of Playwright-style control

Visit official site →

About

Stagehand is an open-source SDK from Browserbase for browser automation that mixes deterministic code with AI-powered actions. Its three core primitives are act() (perform an action in natural language), extract() (schema-validated structured data extraction via Zod), and observe() (discover available elements/actions, returning real selectors so credentials never reach the model). It ships SDKs for TypeScript, Python, and Go, runs against local Chrome or Browserbase cloud browsers, and integrates with coding agents via a hosted MCP server. Caching and self-healing are designed to let repeated automations run without LLM inference and re-resolve actions when a site changes.

What it can do

  • • Natural-language `act()` actions with self-healing when site markup changes
  • • `extract()` returns schema-validated structured data (Zod in TS, Pydantic in Python)
  • • `observe()` discovers elements and returns real selectors so secrets never reach the model
  • • `agent()` primitive for autonomous multi-step browser workflows (v3 API surface)
  • • Full Playwright-style APIs (`goto`, `click`, `locator`, `screenshot`) alongside AI primitives
  • • Action caching (server-side on Browserbase) so repeated runs skip LLM inference
  • • Token-efficient page context via hybrid accessibility-tree trimming
  • • Deep locators for nested iframes and closed Shadow DOMs; WebMCP, clipboard, batch commands, OTel traces
  • • Browserbase cloud features: residential proxies, persistent contexts, verified mode, session recordings
  • • Search and Fetch utilities for markdown extraction and token-efficient web search without a browser

Setup

  1. Scaffold a project (TypeScript): run npx create-browser-app and follow the CLI prompts.
  2. Enter the project directory, copy .env.example to .env, and add your API keys (OPENAI_API_KEY for the model, BROWSERBASE_API_KEY for cloud browsers).
  3. Run the example script with npm start.
  4. (Manual install) TypeScript: pnpm add @browserbasehq/stagehand 'zod@~4.4.3' · Python: pip install stagehand · Go: go get github.com/browserbase/stagehand/packages/sdk-go/v4@v4.0.0.
  5. (MCP access for agents) claude mcp add --transport http browserbase https://mcp.browserbase.com/mcp --header "Authorization: Bearer $BROWSERBASE_API_KEY", or the equivalent JSON block for Cursor/Codex.

Prerequisites

Node.js (TypeScript SDK), Python (pip), or Go toolchain; Chrome installed for local runs. An LLM provider API key (e.g. `OPENAI_API_KEY`) or a Browserbase API key (cloud browsers; the Model Gateway then picks a model per action so no provider is wired up). Keys are passed explicitly — Stagehand v4 never reads environment variables for you.

Use cases

automationtestingdatasearch

Works with

Claude CodeCursorCodexGeneric APIAny agent (.md)

Trust score — 9/10

/10 trustVerified

Scored 9/10 (verified tier, metrics-v1). Evidence: 25,640 GitHub stars (log-scaled vs catalog peers); last push 0d ago; 49 releases/12mo; 393 open issues. Manual review: strong credential hygiene (v4); vendor benchmarks provider-run; cloud browsers cost money. License: MIT.

★ 25,640 GitHub stars

How the trust score is built

Full methodology →
Adoption · stars/downloads, log-scaled vs peers
8.2/10
Maintenance · recency, releases, issue load
9.4/10
Openness · license + docs
10.0/10
Manual review · sanity read + red-flag check
9.0/10
  • · 25,640 GitHub stars (log-scaled vs catalog peers)
  • · last push 0d ago; 49 releases/12mo; 393 open issues
  • · manual review: strong credential hygiene (v4); vendor benchmarks provider-run; cloud browsers cost money

Sources

Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.