Browser Run gives a Worker a managed browser for page rendering and reusable sessions. Use Puppeteer to open public pages, interact with them, inspect their content, and capture screenshots without managing browser infrastructure.
Add the binding
Declare one browser binding in wrangler.jsonc:
{
"compatibility_date": "2026-11-15",
"compatibility_flags": ["nodejs_compat"],
"browser": {
"binding": "BROWSER",
},
}Deploy normally with Wrangler. The platform resolves the declaration into a trusted capability scoped to the organization, Worker, and immutable version. Worker code never receives the Browser Run gateway credential.
Automate a page
Install @cloudflare/puppeteer in your Worker project. Pass the browser binding
to puppeteer.launch() and use the normal page APIs:
import puppeteer from "@cloudflare/puppeteer";
export default {
async fetch(request, env) {
const browser = await puppeteer.launch(env.BROWSER);
try {
const page = await browser.newPage();
await page.goto("https://docs.ermahgerd.io/", {
waitUntil: "domcontentloaded",
});
await Promise.all([
page.waitForNavigation({ waitUntil: "domcontentloaded" }),
page.click('article a[href="/managed/"]'),
]);
const image = await page.screenshot({ type: "png" });
return new Response(image, {
headers: { "Content-Type": "image/png" },
});
} finally {
await browser.close();
}
},
};The examples/browser-run canary also checks destination content and verifies
that disconnecting and reconnecting preserves the live page. Your application
can store screenshots and results using R2, D1, or queues, and schedule checks
with a Cron trigger.
Render a page
Call quickAction() with content, screenshot, pdf, or links:
export default {
async fetch(request, env) {
const url = new URL(request.url).searchParams.get("url");
if (!url) return new Response("url is required", { status: 400 });
return env.BROWSER.quickAction("screenshot", {
url,
viewport: { width: 1280, height: 800, deviceScaleFactor: 1 },
});
},
};The content and links actions return Browser Run’s structured success result.
Screenshot returns image bytes and PDF returns PDF bytes.
Successful responses include X-Browser-Ms-Used, which reports browser
execution time in milliseconds. See examples/browser-run for a complete
Worker with health, content, screenshot, PDF, and link routes.
Keep a session between steps
Disconnect when another invocation needs to continue using the same browser. Keep the session ID in application-owned storage:
const browser = await puppeteer.launch(env.BROWSER, { keep_alive: 60000 });
const page = await browser.newPage();
await page.goto("https://example.com");
const sessionId = browser.sessionId();
await browser.disconnect();
// In a later invocation of the same Worker:
const continued = await puppeteer.connect(env.BROWSER, sessionId);
const pages = await continued.pages();
const details = await env.BROWSER.getSession(sessionId);
await continued.close();For lower-level CDP clients, the binding also exposes acquire(),
connectSession(), launch(), and closeSession(). getSession() returns the
session timing, close reason, browser time, and bounded diagnostic counters;
it returns null for an unknown session. A session belongs to the organization
and originating Worker, across deployment versions. Other Workers cannot inspect,
connect to, or close it. Only one controlling connection is allowed at a time.
Keep session IDs server-side, authorize your application’s callers, and explicitly
close sessions in a finally block when the work is finished.
Use listSessions() for active sessions, history() for recent active and
closed sessions, and limits() for current concurrency and retained browser-time
usage. These methods, and the corresponding Puppeteer transport endpoints, are
scoped to the calling Worker. Lists accept limit and offset and retain at
most 24 hours of evidence.
The platform’s Durable Object coordinator retains session identity, ownership, inactivity state, and terminal status on the existing stateful runtime. The browser engine holds the live page and cookies. Disconnecting and reconnecting preserves that page while the session is active. An engine or coordinator restart ends the session; it does not reconstruct a live page or replay actions. Applications should treat an interrupted session as terminal and apply their own retry policy.
Compatibility
Browser Run uses the experimental Kitesurf engine, not Chromium. Puppeteer’s CDP connection supports the workflows shown here; this does not promise every Chrome API or an entire existing browser test suite. Recordings, location selection, and custom outbound policies are not supported.
Limits and safety
Only public HTTP and HTTPS destinations are reachable. Browser execution cannot connect to the platform service network, loopback, link-local metadata, or private address space. The platform bounds viewport dimensions, action time, concurrent actions per organization, and concurrent actions on the Browser Run member. The shared Browser Run engine is separately bounded from the ordinary application pool; it is not a dedicated browser or host for each tenant.
Each accepted quick action consumes one monthly Browser Run action. The provider reserves the action before execution and fails closed when the quota service is unavailable or the allowance is exhausted. See Usage and quotas for tier allowances.
An admitted session consumes one monthly Browser Run session, even if a later
browser operation fails. Reconnecting, inspecting, and closing do not consume
another session. Quick actions and sessions share the browser member’s execution
capacity (by default two active browsers per organization and eight total).
Sessions close after 60 seconds of inactivity by default. Puppeteer’s
keep_alive option (native keepAlive) accepts 10,000–1,200,000 milliseconds.
This is an inactivity timeout, not a maximum lifetime: commands keep an active
session alive.
Each session allows four page creations including
the initial page, four context creations, 16 target attachments, 10,000 commands,
and 64 pending commands per session. Creation budgets cover the whole session,
not just currently open tabs. Use flattened CDP rather than nested
Target.sendMessageToTarget. Commands are limited to 1 MiB and engine messages
to 32 MiB. Command timeout reports an unknown outcome; commands are never
automatically retried.
Closed-session records are bounded to 24 hours and the most recent 1,000 records across the pool. Persist evidence in your own storage when longer retention is needed. This is not a browser-history archive.
Inspect sessions and usage
Open Compute → Browsers in the tenant console. Overview shows active sessions and monthly session and quick-action usage. Sessions lists retained records across the organization’s Workers, including Workers whose browser binding has since been removed. Filter by Worker and state, then select a session to inspect its lifetime, closure reason, and diagnostic counts. Workers lists current browser bindings and links to their owning Workers.
The workspace is read-only. Applications create and close sessions through their binding; no separate browser resource needs provisioning. Session records are bounded operational evidence, not a complete usage ledger. Usage & limits remains the source for monthly allowances. Session details link to Observability with the calling Worker and session time window selected.

Observe an action
Open Observability → Invocations and select the calling Worker. Browser work
appears inside the parent invocation as a browser.<operation> span, with the
target hostname, response status, duration, and error evidence. The binding on
the Worker overview links to the Browsers session workspace. Its Observability
action opens execution evidence filtered to browser operations.
Session operations add browser.session.acquire, browser.session.list,
browser.session.history, browser.session.limits, browser.session.get, and
browser.session.close spans with session identity, timing, state, and available
diagnostic counters. Counters cover observed CDP requests, failed requests,
HTTP errors, JavaScript exceptions, commands, and command errors; they do not
retain URLs, cookies, page contents, or input text. The initial page has network
and exception reporting enabled; clients controlling additional targets should
enable their corresponding CDP domains. These counters are not Web Vitals,
accurate DNS/TLS timings, or a complete Chrome performance trace.