Skip to main content
Version: Next

StagehandOptions

Configuration options for Stagehand AI-powered browser automation.

Controls the execution environment (local or Browserbase cloud), the AI model used for page operations, and session-level behaviour such as self-healing and DOM settling.

Index

Properties

browserbase_api_key

browserbase_api_key: str | None

API key for authenticating with Browserbase when env='BROWSERBASE'. If not provided, read from the BROWSERBASE_API_KEY environment variable.

dom_settle_timeout_ms

dom_settle_timeout_ms: float | None

Maximum time to wait for the DOM to settle before performing an action, in milliseconds.

env

env: Literal[LOCAL, BROWSERBASE]

Execution environment. 'LOCAL' - Stagehand runs a local Chromium browser. 'BROWSERBASE' - Stagehand uses a Browserbase cloud browser session.

local_ready_timeout_s

local_ready_timeout_s: float

Maximum time to wait for the local Stagehand browser to be ready, in seconds.

model

model: str

The AI model to use for page operations.

model_api_key

model_api_key: str | None

API key for the AI model provider (e.g. OpenAI, Anthropic). Must be provided explicitly - unlike Browserbase credentials

project_id

project_id: str | None

Browserbase project ID, required when env='BROWSERBASE'. If not provided, read from the BROWSERBASE_PROJECT_ID environment variable.

self_heal

self_heal: bool

When True, Stagehand automatically retries failed actions.

system_prompt

system_prompt: str | None

Optional system prompt to guide the AI's behavior in sessions.

verbose

verbose: Literal[0, 1, 2]

Verbosity level for logging Stagehand session activity. 0 - quiet 1 - normal 2 - debug