Stagehand: AI Primitives for Playwright That Actually Stick
TypeScript SDK adding act, extract, and agent primitives to Playwright. v3 is CDP-native, 44% faster, and the caching system replays actions at sub-100ms with zero LLM cost.
The Pitch in One Sentence
Stagehand adds three AI primitives to Playwright: act (do something), extract (pull data out), and agent (figure it out yourself). That's the whole API surface. Write your automation in terms of what you want, not which CSS selector to click.
Why v3 Changed Things
v3 dropped the Playwright dependency entirely and went CDP-native (Chrome DevTools Protocol). That alone made it 44% faster. But the thing that properly changed the economics is the caching system.
First time you run a Stagehand action, it calls the LLM. The model figures out where to click, what to extract, how to navigate. Normal AI-assisted browser stuff, tokens burned, latency incurred. But Stagehand caches that entire resolution. Second time the same action runs against the same page structure, it replays from cache. Sub-100ms. Zero LLM cost. Zero tokens.
Think about what that means for any automation that runs more than once. The first run is your "training" pass. Every subsequent run is basically free. For scraping jobs, for monitoring, for regression checks that hit the same flows repeatedly, the cost curve flattens to nearly nothing after the initial run.
How I Use It
I rotate through a few browser tools depending on what I'm doing, and Stagehand is one that stuck around. The extract primitive is brilliant for pulling structured data out of pages that don't have APIs. Point it at a table, tell it what shape you want the data in, and it sorts it out. No XPath. No fragile selectors that break when someone changes a class name.
The agent primitive is the interesting one for more open-ended tasks. You give it a goal and it figures out the navigation. Less predictable than act, but useful for exploratory automation where you can't script the exact path upfront.
Getting Started
Quickest path:
npx create-browser-app
That scaffolds a project with Stagehand wired up. If you're already running Browserbase skills in your agent setup:
npx skills add browserbase/skills
The caching works out of the box. No config needed. Run your automation once, watch the LLM calls, then run it again and watch them disappear. That's the bit that sells it.