Integrations / Automation libraries / Stagehand

Stagehand, on a local Browz profile.

Stagehand can run against a local browser. Point it at a Browz profile and act, extract and observe run in a saved browser with its own fingerprint, proxy and cookies, on your computer.

Terminalnpm install @browserbasehq/stagehand@3 zod @browz/sdk

Setup

Set it up.

  1. Install Browz and open it

    Download Browz.

  2. Install

    Pin Stagehand 3: see the notes for why not 4.

    Terminalnpm install @browserbasehq/stagehand@3 zod @browz/sdk
  3. Drive a fresh profile

    stagehandOptions(session) sets env: 'LOCAL' and the profile’s cdpUrl. Set ANTHROPIC_API_KEY first.

    run.mjsimport { Stagehand } from '@browserbasehq/stagehand'; import { withBrowzSession, stagehandOptions } from '@browz/sdk'; await withBrowzSession(async (session) => { const stagehand = new Stagehand(stagehandOptions(session, { model: 'anthropic/claude-haiku-5-5' })); await stagehand.init(); const page = stagehand.context.pages()[0]; await page.goto('https://example.com'); console.log(await page.title()); await stagehand.close(); });

Options from Stagehand v3 reference.

Example

Extract structured data.

Inside the same session, extract takes an instruction and a zod schema.

extract.mjsimport { Stagehand } from '@browserbasehq/stagehand'; import { withBrowzSession, stagehandOptions } from '@browz/sdk'; import { z } from 'zod'; await withBrowzSession(async (session) => { const stagehand = new Stagehand(stagehandOptions(session, { model: 'anthropic/claude-haiku-5-5' })); await stagehand.init(); const page = stagehand.context.pages()[0]; await page.goto('https://example.com'); const data = await stagehand.extract('the page title and the text of its only link', z.object({ title: z.string(), link: z.string() })); console.log(data); await stagehand.close(); });

Good to know

Notes and tips.

  • Use Stagehand 3: it connects to the running profile over CDP as it is. Browz starts each profile with that profile’s own extensions, so the profile stays exactly as you set it up (tested 9 November 2026).
  • Attach to the browser Browz started; never let the library launch its own. A library-launched browser is a stock one with none of the profile’s fingerprint, proxy or cookies.
  • A person completes sign-ins, 2FA codes and CAPTCHAs in the profile’s window; your script can wait for the page that follows. Browz never solves or bypasses CAPTCHAs.
  • Automate only where each site’s terms allow it. Our acceptable use policy applies to scripts the same as to people.
  • The local API, CDP and the SDKs are on every plan, Free included (5 profiles), and are not metered.

FAQ

Stagehand and Browz.

Does it need a Browserbase account?

No. With env LOCAL and a cdpUrl, Stagehand drives the Browz profile on your computer.

Which models work?

Any model Stagehand 3 supports, set with model as provider/name.

Does stagehand.close() stop the profile?

It detaches. withBrowzSession then stops the profile and, unless you keep it, deletes it.

Get started

Download Browz. Every task, its own browser.

Then, on macOS or Linux, put the MCP server on your PATHcurl -fsSL https://gobrowz.com/agents/install.sh | sh

For Mac, Windows and Linux. Free for 5 profiles. Paid plans from $4.99 a month, with a 14-day refund on your first payment.