docs(sdk): clarify regional baseUrl usage and deprecate request region#2152
docs(sdk): clarify regional baseUrl usage and deprecate request region#2152BABTUNA wants to merge 1 commit into
Conversation
Documents how to select a regional Stagehand API endpoint via baseUrl / base_url / option.WithBaseURL() across the Go, Java, Python, and Ruby SDKs, and marks browserbaseSessionCreateParams.region as deprecated in the generated OpenAPI spec. On hosted Stagehand the Browserbase session region is determined by the Stagehand API base URL the client calls; any client-provided region in browserbaseSessionCreateParams is overridden to the API instance's AWS_REGION. baseUrl is the user-facing mechanism that should be documented. Adds the four regional Stagehand API endpoints to the OpenAPI servers list (us-west-2 default, us-east-1, eu-central-1, ap-southeast-1) and applies deprecated: true to the region field via Stainless patches so generated SDKs reflect the deprecation. Revives browserbase#1820 by monadoid.
|
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
There was a problem hiding this comment.
No issues found across 10 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant Dev as Developer
participant SDK as Generated SDK Client
participant OpenAPI as OpenAPI Spec
participant Server as Stagehand API Server
participant Browserbase as Browserbase Session
Note over Dev,Browserbase: Client Configuration Flow
Dev->>SDK: Initialize client with region-specific baseUrl
alt Go SDK
Dev->>SDK: stagehand.NewClient(option.WithBaseURL("https://api.euc1..."))
else Java SDK
Dev->>SDK: StagehandOkHttpClient.builder().baseUrl("https://api.euc1...")
else Python SDK
Dev->>SDK: AsyncStagehand(base_url="https://api.euc1...")
else Ruby SDK
Dev->>SDK: Stagehand::Client.new(base_url: "https://api.euc1...")
end
Note over OpenAPI,SDK: OpenAPI servers list regional endpoints
OpenAPI->>SDK: Provide regional baseUrl options
SDK-->>Dev: Client configured for selected region
Note over Dev,Browserbase: Runtime Session Creation
Dev->>SDK: Create session (optionally with deprecated region field)
SDK->>Server: POST /v1/session to configured baseUrl
alt If region field provided in request
Server->>Server: Override: use AWS_REGION from deployment instead
end
Server->>Browserbase: Create browser session in region matching baseUrl
Browserbase-->>Server: Session created
Server-->>SDK: Session response
SDK-->>Dev: Session ready
Note over OpenAPI,Server: Region Selection Behavior
alt Client uses us-west-2 default (https://api.stagehand.browserbase.com)
Server->>Browserbase: Launch in us-west-2
else Client chooses us-east-1 (https://api.use1.stagehand.browserbase.com)
Server->>Browserbase: Launch in us-east-1
else Client chooses eu-central-1 (https://api.euc1.stagehand.browserbase.com)
Server->>Browserbase: Launch in eu-central-1
else Client chooses ap-southeast-1 (https://api.apse1.stagehand.browserbase.com)
Server->>Browserbase: Launch in ap-southeast-1
end
What
Adds clearer documentation for using
baseUrl/base_url/option.WithBaseURL()to select a regional Stagehand API endpoint in the generated Go, Java, Python, and Ruby SDK docs. MarksbrowserbaseSessionCreateParams.regionas deprecated in the generated OpenAPI spec.Why
For hosted Stagehand, the API endpoint the client calls is what determines the pod region. The hosted server overrides any client-provided
browserbaseSessionCreateParams.regionwith the API instance'sAWS_REGION, sobaseUrlis the correct user-facing mechanism to document.Changes
Client configuration/baseUrlexamples to Go, Java, Python, and Ruby SDK docsregioninBrowserbaseSessionCreateParamsSchemaservers(us-west-2 default, us-east-1, eu-central-1, ap-southeast-1) for both server-v3 and server-v4deprecated: truetoregionvia Stainless patches so generated SDKs reflect the deprecationNote
This is a revive of #1820 by @monadoid. Original PR was approved but went stale and conflicts with
main. Rebased onto currentmainand resolved conflicts inpackages/server-v4/openapi.v4.yaml(the schema layout shifted but the region field changes apply cleanly to bothBrowserbaseSessionCreateParamsandBrowserbaseSessionCreateParamsOutput).Authorship preserved via
git commit --author.Summary by cubic
Clarifies how to choose a Stagehand region via the client
baseUrland deprecates the request-levelregionfor Browserbase sessions. OpenAPI now lists regional endpoints so generated SDKs and docs reflect endpoint-based routing.New Features
option.WithBaseURL(),baseUrl, andbase_urlexamples for regional endpoints.Migration
baseUrlto pick a region; stop relying on requestregion(deprecated and ignored on hosted Stagehand).Written for commit 3cb8fd4. Summary will update on new commits. Review in cubic