For agents to do most knowledge work, they needs access to the internet. Today most people allow their agents to use Playwright to control a browser for them.
But Playwright was built for testing, not agents.
If you’ve ever tried to give it to your agent, you’ll quickly run into bloated context windows, inability to use iframes, and painful state sync issues (on remote browsers).
We built Stagehand specifically for agents. v4 fixes all of Playwright’s issues, with better page snapshotting, nested iframe support, webmcp, self-healing primitives, and we even rebuilt it to run as an extension in the browser which minimizes round trip time for all requests.
We’re roughly ~80% more token efficient and 2x faster than Playwright.
Use AI primitives for self-healing automations in natural language:
// Act: execute natural language actions
await stagehand.act("click the login button");
// Extract: pull structured data
const { data } = await stagehand.extract(
"extract the price",
z.object({ price: z.number() }),
);
// Observe: discover available actions
const { data: actions } = await stagehand.observe("find submit buttons");
Or use familiar Playwright-style APIs: const page = await stagehand.browser.context.activePage();
await page.goto("https://example.com");
await page.locator('textarea[name="q"]').fill("Browserbase");
await page.keyPress("Enter");
await page.screenshot();
Stagehand v4 is live today, we built some reference integrations with popular agent frameworks like LangChain DeepAgents, Mastra, Vercel’s eve, and CrewAI.Checkout the docs - docs.stagehand.dev
And join our discord for updates and feedback - discord.gg/stagehand