Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
- run: pnpm build
- run: git diff --exit-code -- packages/protocol/stagehand.v4.json
- run: pnpm check
- run: pnpm test:unit
- run: uv lock --check
working-directory: packages/sdk-python
- run: uv run --locked python scripts/generate.py --check
Expand Down
120 changes: 119 additions & 1 deletion packages/docs/v4/reference/stagehand.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,42 @@ const stagehand = await Stagehand.create({ browser });
A browser handle from `browserbase.launch()`, `browserbase.connect()`, `localBrowser.launch()`, or `localBrowser.connect()`. Each handle can back only one Stagehand instance.
</ParamField>

<ParamField path="apiKey" type="string" optional>
Browserbase API key used by managed services such as Model Gateway and server-side caching.
</ParamField>

<ParamField path="apiUrl" type="string" optional>
Stagehand API origin override for managed services. Use the service origin without `/v1`.
</ParamField>

<ParamField path="model" type="ModelConfig | ClientLLM" optional>
Default model configuration or client-provided generation callback. Browserbase selects a model automatically for Gateway sessions when omitted.
</ParamField>

<ParamField path="telemetry" type="StagehandCreateOptions['telemetry']" optional>
OpenTelemetry trace export configuration.
</ParamField>

<ParamField path="systemPrompt" type="string" optional>
Additional system instructions included in model calls.
</ParamField>

<ParamField path="selfHeal" type="boolean" optional>
Whether Stagehand re-infers and retries a cached action when its recorded selector no longer resolves.
</ParamField>

<ParamField path="domSettleTimeoutMs" type="number" optional>
Maximum time in milliseconds to wait for the DOM to settle before an operation.
</ParamField>

<ParamField path="cache" type="Caching" optional>
Instance-level server-side cache setting for `act()`, `observe()`, and `extract()`.
</ParamField>

<ParamField path="logging" type="StagehandClientLoggingConfig" optional>
Client-side log level, output format, and optional log callback.
</ParamField>

<ResponseField name="result" type="Promise<Stagehand>">
An initialized Stagehand instance.
</ResponseField>
Expand Down Expand Up @@ -854,6 +890,50 @@ stagehand = await Stagehand.create(browser=browser)
A browser handle from `browserbase.launch()`, `browserbase.connect()`, `local_browser.launch()`, or `local_browser.connect()`. Each handle can back only one Stagehand instance.
</ParamField>

<ParamField path="api_key" type="str" optional>
Browserbase API key used by managed services such as Model Gateway and server-side caching.
</ParamField>

<ParamField path="api_url" type="str" optional>
Stagehand API origin override for managed services. Use the service origin without `/v1`.
</ParamField>

<ParamField path="model" type="str | LLMGenerateCallback" optional>
Default provider-prefixed model name or client-provided generation callback. Browserbase selects a model automatically for Gateway sessions when omitted.
</ParamField>

<ParamField path="model_api_key" type="str" optional>
Provider API key for the model named by `model`. It cannot be used with a generation callback.
</ParamField>

<ParamField path="model_headers" type="Mapping[str, str]" optional>
Custom provider headers for the model named by `model`. They cannot be used with a generation callback.
</ParamField>

<ParamField path="telemetry" type="TelemetryConfig" optional>
OpenTelemetry trace export configuration.
</ParamField>

<ParamField path="system_prompt" type="str" optional>
Additional system instructions included in model calls.
</ParamField>

<ParamField path="self_heal" type="bool" optional>
Whether Stagehand re-infers and retries a cached action when its recorded selector no longer resolves.
</ParamField>

<ParamField path="dom_settle_timeout_ms" type="int" optional>
Maximum time in milliseconds to wait for the DOM to settle before an operation.
</ParamField>

<ParamField path="cache" type="Cache" optional>
Instance-level server-side cache setting for `act()`, `observe()`, and `extract()`.
</ParamField>

<ParamField path="logging" type="StagehandClientLoggingConfig" optional>
Client-side log level, output format, and optional log callback.
</ParamField>

<ResponseField name="result" type="Stagehand">
An initialized Stagehand instance.
</ResponseField>
Expand Down Expand Up @@ -1631,7 +1711,45 @@ func Create(ctx context.Context, options CreateOptions) (*Stagehand, error)
A browser handle from `LaunchBrowserbase()`, `ConnectBrowserbase()`, `LaunchLocalBrowser()`, or `ConnectLocalBrowser()`. Each handle can back only one Stagehand instance.
</ParamField>

The remaining `CreateOptions` fields (`APIKey`, `APIURL`, `Cache`, `DOMSettleTimeoutMs`, `Model`, `Generate`, `Logging`, `SelfHeal`, `SystemPrompt`, and `Telemetry`) are optional and covered in the configuration guides.
<ParamField path="options.APIKey" type="*string" optional>
Browserbase API key used by managed services such as Model Gateway and server-side caching.
</ParamField>

<ParamField path="options.APIURL" type="*string" optional>
Stagehand API origin override for managed services. Use the service origin without `/v1`.
</ParamField>

<ParamField path="options.Model" type="*ModelConfig" optional>
Default model configuration. Browserbase selects a model automatically for Gateway sessions when omitted.
</ParamField>

<ParamField path="options.Generate" type="LLMGenerateFunc" optional>
Client-provided generation callback used instead of `options.Model`.
</ParamField>

<ParamField path="options.Telemetry" type="TelemetryConfig" optional>
OpenTelemetry trace export configuration.
</ParamField>

<ParamField path="options.SystemPrompt" type="*string" optional>
Additional system instructions included in model calls.
</ParamField>

<ParamField path="options.SelfHeal" type="*bool" optional>
Whether Stagehand re-infers and retries a cached action when its recorded selector no longer resolves.
</ParamField>

<ParamField path="options.DOMSettleTimeoutMs" type="*int" optional>
Maximum time in milliseconds to wait for the DOM to settle before an operation.
</ParamField>

<ParamField path="options.Cache" type="*Caching" optional>
Instance-level server-side cache setting for `Act()`, `Observe()`, and `Extract()`.
</ParamField>

<ParamField path="options.Logging" type="*StagehandClientLoggingConfig" optional>
Client-side log level, output format, and optional log callback.
</ParamField>

<ResponseField name="result" type="(*Stagehand, error)">
An initialized Stagehand instance.
Expand Down
Loading
Loading