Multi-region stagehand api support
Merged
MI
9mo ago+690+690+012345678901234567890123456789-43-43-01234567890123456789
why
Server-side multi-region support enabled for all Browserbase regions:
us-west-2(default)us-east-1eu-central-1ap-southeast-1
what changed
Added multi-region routing to the Stagehand API client so requests use the endpoint that matches the Browserbase session’s region. Updates OpenAPI and docs, adds tests, and fixes STAGEHAND_API_URL handling.
New Features
- Route API calls by session region via REGION_API_URLS/getApiUrlForRegion; supports us‑west‑2 (default), us‑east‑1, eu‑central‑1, ap‑southeast‑1.
- Store the session region in the client; remove the non–us‑west‑2 restriction.
- Add BrowserbaseRegion schema/type; unit tests for region→URL and /v1 suffix; integration tests verify non‑default regions return available: true.
- OpenAPI adds regional servers and shared BrowserbaseRegion schema.
- Docs: add region/endpoint table, setup examples, mismatch error guidance, and the disableAPI option.
Bug Fixes
- Ensure STAGEHAND_API_URL resolves to exactly one /v1.
- Update SDK error messages to reference disableAPI.
- Fix OpenAPI table rendering by removing blank lines between markdown table rows.
test plan
Summary by cubic
Adds multi-region routing to the Stagehand API client so requests use the API that matches the Browserbase session’s region. Updates v3 OpenAPI/docs and tests; honors and normalizes STAGEHAND_API_URL; v2 docs changes remain reverted.
-
New Features
- Route API calls by session region (us-west-2 default, us-east-1, eu-central-1, ap-southeast-1); removed the us‑west‑2‑only restriction.
- Add REGION_API_URLS/getApiUrlForRegion and store session region; v3 OpenAPI adds regional servers and a shared BrowserbaseRegion schema; docs add region table, mismatch guidance, and disableAPI examples.
-
Bug Fixes
- Normalize STAGEHAND_API_URL to include exactly one /v1; getApiUrlForRegion always returns a /v1 URL; SDK error text references disableAPI.
- Fix OpenAPI rendering (literal scalar description, quoted versions) and preserve table formatting in generated YAML.
- Tests: add unit and integration coverage for regions; use try/finally to prevent session leaks; remove unused env scaffolding; use LOCAL_BROWSER_BODY in multiRegion tests for CI stability.