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.
npm install @browserbasehq/stagehand@3 zod @browz/sdkSetup
Set it up.
Install Browz and open it
Install
Pin Stagehand 3: see the notes for why not 4.
Terminalnpm install @browserbasehq/stagehand@3 zod @browz/sdkDrive a fresh profile
stagehandOptions(session)setsenv: 'LOCAL'and the profile’scdpUrl. SetANTHROPIC_API_KEYfirst.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.
import { 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.
curl -fsSL https://gobrowz.com/agents/install.sh | sh