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.
1

Create a sample project

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 the Browserbase API key in your own code and pass it to the browser factory, as the script above does. With no model configured, Browserbase selects one automatically for each inference call.
3

Run it

Set your Browserbase API key, then run the script. Model Gateway selects and authenticates the model automatically, so no model provider key is required.
Prefer to run against a browser on your own machine while you develop? Swap browserbase.launch() for localBrowser.launch() and drop the Browserbase key. 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