🌐 US-Proxy
class="h-dvh overflow-hidden bg-neutral-300 font-body text-chrome-ink">
// from the blog: introducing stagehand v4 β†’

Stagehand is the SDK for browser agents.

Playwright was built for testing, Stagehand is built for agents. Use familiar APIs, self-healing actions, and network-level security across TypeScript, Python, and Go.

Wall-clock time

lower is better

stagehandplaywright
4.7s
9.0s
97ms
364ms
291ms
1.5s
batchclicktype
++

Your agent's favorite browser tool

everything an agent needs to control a browser

stagehand 7.4kplaywright 35.7k

Token efficiency as a priority

Our hybrid accessibility tree trimming gives your agents exactly what they need to understand the page and nothing more.

goto()click()locator()screenshot()

Familiar APIs

The Playwright-style methods you and your agents already know and love (goto, click, locator, screenshot).

sdkworkerpage

Faster in production

Stagehand lives right next to the browser, so your agent’s actions feel instant, not remote.

a.cta β†’ a[data-v2].cta β†’ healed βœ“

Self-healing primitives

Use Act, Observe, and Extract with natural language to automate pages. When sites change, we detect it and refresh how the actions happen on the page automatically.

webmcpclipboardotel+ more

Features Agents need

WebMCP, Clipboard Support, Self-healing actions, Batched commands, deep locators for nested iframes, and OTel support.

++

// how it's built

Stagehand runs as an extension next to the browser, closing the distance and reducing round-trip latency for all actions on the page.

your code
the page
browser extension
++

// control a page with natural language

source β€” quickstart.tsts
β€Ίbrowser opens01/06
↓

y combinator β€” top stories

β–²Show HN: Stagehand, the SDK for browser agents+1 Β· sh.act, 21ms
β–²Show HN: Legacy automation framework
{
"title": "Show HN: Stagehand, the SDK…",
"points": 128,
"upvoted": true
}
++

// see the code

quickstart.ts
import { z } from "zod/v4";
import { localBrowser, Stagehand } from "@browserbasehq/stagehand";

const browser = await localBrowser.launch();
const sh = await Stagehand.create({ browser });

const page = await browser.context.activePage();
if (!page) throw new Error("Stagehand initialized without an active page");

await page.goto("https://news.ycombinator.com");

const result = await sh.extract(
  "Extract the top 5 stories",
  z.object({
    stories: z.array(
      z.object({
        title: z.string(),
        points: z.number(),
      }),
    ),
  }),
);

console.log(result.data.stories);

await sh.close();
await browser.close();
capabilitystagehandplaywright
Designed foragentstesting
Playwright-style APIyesyes
Runtime lives in browseryesno
Shadow DOM and iframe supportyesno
WebMCP supportyesno
Domain allowlist/blocklistyesno
Built-in OTel tracingyesno

2x

faster than playwright

80%

more token efficient

++

// why stagehand

Stagehand gives browser agents an interface built for how they actually work. It combines familiar Playwright-style APIs with self-healing actions, agent-optimized page context, and native support for complex DOM structures like out-of-process iframes and closed Shadow DOMs.

Agents use fewer tokens, recover when websites change, and complete tasks more reliably. With a complete browser driver across TypeScript, Python, and Go, Stagehand delivers the flexibility of AI without sacrificing the speed, control, determinism, reliability, and observability required in production.

Your agent should be able to use a browser like you do.

The SDK for browser agents