WebX Docs
← Catalog Raw Markdown Open console

Move a Browserbase session workload to WebX

WebX exposes a Browserbase-shaped session data plane under /v1. The goal is to make evaluation reversible: keep Playwright/Puppeteer and the familiar session lifecycle, change the API base URL, then opt into WebX's verified execution features when they are useful.

What is compatible

Browserbase contractWebX
X-BB-API-KeyAccepted alongside x-api-key and Bearer auth
POST /v1/sessionsCreates an isolated Chromium process and returns connectUrl
GET /v1/sessionsLists tenant-scoped sessions
GET /v1/sessions/:idReturns Browserbase-style lifecycle metadata
POST /v1/sessions/:id with REQUEST_RELEASEReleases the browser
GET /v1/sessions/:id/debugReturns an interactive signed live-view URL
GET /v1/sessions/:id/logsReturns captured CDP/network/console/audit events
GET /v1/sessions/:id/recordingReturns captured JPEG replay events

The response also includes a webx object with receipt, execution-receipt, replay, live-view, and webx why links. Existing clients ignore this additive field; trust-aware clients can use it immediately.

Playwright example

import { chromium } from "playwright-core";

const api = "https://webx.agentslab.host";
const response = await fetch(`${api}/v1/sessions`, {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-bb-api-key": process.env.WEBX_API_KEY!,
  },
  body: JSON.stringify({
    timeout: 300,
    keepAlive: false,
    browserSettings: { viewport: { width: 1440, height: 900 } },
    userMetadata: { workload: "migration-smoke" },
  }),
});

if (!response.ok) throw new Error(await response.text());
const session = await response.json();

const browser = await chromium.connectOverCDP(session.connectUrl);
const context = browser.contexts()[0];
const page = context.pages()[0];
await page.goto("https://example.com");
console.log(await page.title());

await browser.close();
await fetch(`${api}/v1/sessions/${session.id}`, {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-bb-api-key": process.env.WEBX_API_KEY!,
  },
  body: JSON.stringify({ status: "REQUEST_RELEASE" }),
});

Stagehand compatibility smoke test

The repository pins the currently qualified Stagehand client and exercises its real Browserbase-mode provisioning + CDP attachment flow:

cd conformance/stagehand
npm ci
WEBX_API_KEY=... WEBX_URL=https://webx.agentslab.host npm run smoke

The smoke test initializes Stagehand with disableAPI: true, discovers its active WebX page, navigates to Example Domain, validates the title/URL, and closes the session. This catches compatibility drift in the public Stagehand package instead of treating a generated snippet as proof.

The connectUrl contains a short-lived HMAC capability. It can access only that session's /connect and /live data plane; it cannot call REST APIs or reach another tenant's session.

Honest incompatibilities

WebX rejects options it cannot enforce rather than silently pretending they worked:

Those are platform gaps, not response-shape gaps. They remain explicit so a migration cannot produce false confidence.