Skip to main content
The quickest way to start with Stagehand is to install the SDK, point it at a browser, and write a script. This page gets you from an empty directory to a working automation in three steps, using a browser on your own machine.
1

Create a sample project

Keep Zod on the 4.4.x minor version to match Stagehand’s supported types. Newer Zod minor versions can cause TypeScript errors when passing schemas to extract().
Stagehand drives a local browser through the Chrome DevTools Protocol, so install Chrome on your machine before running the script.
2

Write the script

Create the example script (index.ts, main.py, or main.go). It exercises all three primitives: act, extract, and observe.
Stagehand never reads environment variables on your behalf. Read your model provider API key in your own code and pass it to Stagehand.create(), as the script above does. A local browser cannot use the Model Gateway, so Stagehand requires you to provide a model and its API key.
3

Run it

Set your model provider API key, then run the script. Stagehand launches Chrome on your machine and opens a visible window, so you can watch each step as it happens.
Ready to run in the cloud, with stealth, proxies, and session recordings? Swap localBrowser.launch() for browserbase.launch() with your Browserbase API key, and the Model Gateway picks and authenticates a model for you. See Browser configuration.

Next steps

Learn about the Stagehand primitives: act, extract, and observe.

Act

Perform actions on web pages with natural language

Extract

Get structured data with typed schemas

Observe

Discover available elements and actions

Installation

Add Stagehand to an existing project