Skip to content

docs(sdk): clarify regional baseUrl usage and deprecate request region#2152

Open
BABTUNA wants to merge 1 commit into
browserbase:mainfrom
BABTUNA:revive/baseurl-docs
Open

docs(sdk): clarify regional baseUrl usage and deprecate request region#2152
BABTUNA wants to merge 1 commit into
browserbase:mainfrom
BABTUNA:revive/baseurl-docs

Conversation

@BABTUNA
Copy link
Copy Markdown
Contributor

@BABTUNA BABTUNA commented May 21, 2026

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. Marks browserbaseSessionCreateParams.region as 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.region with the API instance's AWS_REGION, so baseUrl is the correct user-facing mechanism to document.

Changes

  • Add Client configuration / baseUrl examples to Go, Java, Python, and Ruby SDK docs
  • Add deprecation description + example for region in BrowserbaseSessionCreateParamsSchema
  • Add the four regional Stagehand API endpoints to OpenAPI servers (us-west-2 default, us-east-1, eu-central-1, ap-southeast-1) for both server-v3 and server-v4
  • Apply deprecated: true to region via Stainless patches so generated SDKs reflect the deprecation

Note

This is a revive of #1820 by @monadoid. Original PR was approved but went stale and conflicts with main. Rebased onto current main and resolved conflicts in packages/server-v4/openapi.v4.yaml (the schema layout shifted but the region field changes apply cleanly to both BrowserbaseSessionCreateParams and BrowserbaseSessionCreateParamsOutput).

Authorship preserved via git commit --author.


Summary by cubic

Clarifies how to choose a Stagehand region via the client baseUrl and deprecates the request-level region for Browserbase sessions. OpenAPI now lists regional endpoints so generated SDKs and docs reflect endpoint-based routing.

Written for commit 3cb8fd4. Summary will update on new commits. Review in cubic

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.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

⚠️ No Changeset found

Latest commit: 3cb8fd4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run.
Approving the latest commit mirrors it into an internal PR owned by the approver.
If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels May 21, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants