Skip to main content
Install Stagehand in your current app.
Node.js is the recommended runtime environment for Stagehand scripts. Stagehand requires Node.js 22.18 or later, Python 3.11 or later, or Go 1.26 or later.Bun is supported. Stagehand drives the browser over the Chrome DevTools Protocol and has no Playwright dependency, so there is no runtime caveat.

Install dependencies

If you plan to run locally, you need to have Chrome installed on your machine. For cloud browser sessions, skip this.

Configure environment

Set your Browserbase API key. When no model is configured, Model Gateway selects one automatically, so no model provider key is required:
Stagehand does not read environment variables on your behalf, and it does not auto-load env files.This also applies to API routing: pass non-production Browserbase and Stagehand API URLs explicitly rather than setting BROWSERBASE_BASE_URL or STAGEHAND_API_URL. See API endpoint overrides.
Read the values in your own app code and pass them explicitly to the browser factory:

Use in your codebase

Add Stagehand where you need browser automation.

Next steps

Configuration

Browser sources, Browserbase vs local, logging, timeouts, LLM customization

Act

Perform precise actions with natural language

Extract

Typed data extraction with schemas

Observe

Discover elements and suggested actions