Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

Headless Browser Sessions: Limits, Quick Actions, Pricing, and Reuse

How Cloudflare Browser Run limits, billing, Quick Actions, session reuse, and close reasons work—and how to avoid 429 errors and wasted browser time.

This page summarises Cloudflare Browser Run documentation (formerly Browser Rendering): running headless Chrome on Cloudflare’s network for screenshots, PDFs, scraping, testing, and automation. It focuses on choosing between Quick Actions and Browser Sessions, plan limits, billing, keeping sessions alive, and what to do when jobs fail or sessions close unexpectedly.

Browser Run: Quick Actions vs Browser Sessions

Section titled “Browser Run: Quick Actions vs Browser Sessions”

Browser Run is programmatic headless Chrome for browser automation, web scraping, testing, and content generation, available on Workers Free and Paid plans.

Run headless Chrome on Cloudflare’s global network for browser automation, web scraping, testing, and content generation.

— Cloudflare, Browser Run

Get started describes two integration paths:

Use case Recommended approach Why
Simple screenshot, PDF, or scrape Quick Actions No Worker deployment; single HTTP request
Full browser automation Puppeteer, Playwright, or CDP Scripting and full control
Site-wide crawling Crawl endpoint Multi-page extraction with async results
Porting existing scripts Puppeteer, Playwright, or CDP Close to standard libraries

Quick Actions are stateless one-shot tasks (/content, /screenshot, /pdf, /markdown, /snapshot, /scrape, /json, /links, and /crawl). Browser Sessions use Puppeteer, Playwright, CDP, or Stagehand inside Workers (or CDP from outside) and count against concurrency and launch-rate limits.

Plan limits: browser time, concurrency, and rate caps

Section titled “Plan limits: browser time, concurrency, and rate caps”

Browser Run limits depend on your Workers plan. Defaults on Workers Paid have been raised over time (for example concurrent browsers from 120 to 200); the table below matches the current limits page and recent limit increases.

Feature Workers Free Workers Paid (defaults)
Browser hours 10 minutes per day No hard cap; see pricing
Concurrent browsers (Browser Sessions only) 3 per account 200 per account
New browser instances (Browser Sessions only) 1 every 20 seconds 3 per second
Browser inactivity timeout 60 seconds (extendable with keep_alive) Same
Quick Actions request rate 1 every 10 seconds 30 per second

The limits below are defaults for Workers Paid users. If you need to scale beyond them, Cloudflare can increase your account limits.

— Cloudflare, Limits

Published defaults are not maximums; changelog entries state you can request higher limits when needed. REST API / Quick Actions throughput on Paid plans was also increased (for example from 3 to 10 requests per second, with later defaults at 30 per second for Quick Actions)—see Browser Rendering REST API rate limit.

Orphan sessions are the usual cause: if you skip browser.close(), the browser stays open and bills until the inactivity timeout (60 seconds by default, or up to 20 minutes with keep_alive).

Always call browser.close() when you are finished with a browser session. Wrap your browser code in a try/finally block to ensure browser.close() is called even if an error occurs.

— Cloudflare, Limits

Use puppeteer.history() or playwright.history() and the Browser Run dashboard (Compute → Browser Run) to spot sessions that closed with BrowserIdle instead of NormalClosure—documented in Puppeteer and Playwright.

Pricing: browser hours and concurrent browsers

Section titled “Pricing: browser hours and concurrent browsers”

Billing depends on how you invoke Browser Run (pricing):

  • Quick Actions: charged for browser hours only.
  • Browser Sessions (Puppeteer, Playwright, CDP): charged for browser hours and concurrent browsers (monthly average of daily peaks).
Plan Included browser hours Included concurrency (sessions) Beyond included
Workers Free 10 minutes per day 3 concurrent browsers N/A (no paid overage on Free)
Workers Paid 10 hours per month 10 concurrent browsers (monthly average) $0.09 per additional browser hour; $2.00 per additional concurrent browser

REST API: Charged for Duration only ($/browser hour)
Browser Sessions: Charged for both Duration and Concurrency ($/browser hour and # of concurrent browsers)

— Cloudflare, Introducing pricing for the Browser Rendering API

Browser hours are shared across all methods. Billing rounds daily usage into monthly hours (30+ minutes in a day can round up to a full hour for billing—see pricing FAQ). Quick Actions responses include X-Browser-Ms-Used for per-request time. Failed Quick Actions with waitForTimeout are not charged for browser time (pricing).

Browser Run sessions are billed based on usage. Cloudflare does not charge for sessions that error due to underlying Browser Run infrastructure (browser close reasons).

Launching a new browser for every task costs cold-start time and counts against concurrent browsers and new instance rate limits. Tabs in an existing session do not count as extra browser instances (FAQ).

For most workloads, reuse an existing browser session and open a new tab instead of launching a fresh browser for each task.

— Cloudflare, FAQ

Reuse sessions covers connecting multiple clients to one running browser, using separate browser contexts for isolation, and calling browser.disconnect() (not browser.close()) when others share the session—browser.close() terminates the browser for every client.

Default inactivity closure is 60 seconds without commands. Extend idle tolerance up to 20 minutes with keep_alive (milliseconds), on both Puppeteer and Playwright:

const browser = await puppeteer.launch(env.MYBROWSER, { keep_alive: 1200000 });

That is an inactivity timeout, not a maximum lifetime: sessions can run longer if you send commands within the window (limits).

For isolation without a new browser, use incognito browser contexts (FAQ). At high volume, Queues or Workflows help throttle concurrent launches.

Browser close reasons and resilient automation

Section titled “Browser close reasons and resilient automation”

Sessions can end from normal shutdown, idle timeout, Chromium crashes, network or Worker CPU limits, or platform maintenance (browser close reasons).

Reason Meaning Typical action
Normal closure browser.close() ran None
Browser idle No commands within inactivity window Send commands sooner or raise keep_alive
Chromium crashed Often memory pressure (large DOM, heavy JS) Simplify pages, fewer tabs, smaller jobs
Connection error Network, CPU limit, WebSocket drop Retry with try/catch
Session evicted Infrastructure maintenance or release Retry with reconnection

Sessions can close at any time due to infrastructure events, network issues, or browser crashes. Design your code to handle these cases by wrapping browser operations in a try…catch block and reconnecting when needed.

— Cloudflare, Browser close reasons

Inspect close reasons under Browser Run → Runs in the dashboard (browser close reasons). Use puppeteer.limits() / playwright.limits() to see active sessions and whether a new acquisition is allowed (Puppeteer).

HTTP 429: rate limits vs daily browser time

Section titled “HTTP 429: rate limits vs daily browser time”

Two different 429 situations appear in the docs:

  1. Too many requests per second (Quick Actions or launch rate): read Retry-After and retry (limits).
  2. Browser time limit exceeded for today (Workers Free daily 10-minute cap): upgrade to Workers Paid and redeploy if the plan change does not apply immediately (FAQ).

A 422 Unprocessable Entity often reflects the target site: timeouts, crashes, or excessive memory during render (FAQ). For /crawl, status cancelled_due_to_limits means the account hit its browser time limit—for Free users, the same 10 minutes per day cap. Mitigations from the crawl endpoint docs include upgrading, using render: false for static pages, raising maxAge for cache, and lowering the crawl limit parameter.

Data retention, outbound traffic, and common mistakes

Section titled “Data retention, outbound traffic, and common mistakes”

Most paths process content ephemerally and discard customer HTML and outputs after the response (FAQ). Exceptions: /crawl job results stored up to 14 days (jobs may run up to seven days), and opt-in session recording retained 30 days.

Browser Run does not offer per-request outbound IP rotation; traffic uses Cloudflare IP ranges with identifying headers such as cf-biso-request-id (FAQ).

Common mistakes

  • Launching a new browser per URL instead of reusing sessions and tabs.
  • Calling browser.close() on a shared session other workers still use.
  • Leaving sessions open without browser.close() or without activity (idle billing until timeout).
  • Ignoring Retry-After on 429 rate-limit responses.
  • Running heavy parallel tabs in one browser (memory crash → Chromium crashed).
  • Expecting logged-in state: each fresh Browser Sessions context starts without your cookies unless you engineer it (browser agent examples note no authenticated sessions for agent browser_execute—see browser agent only if you use Agents).
  1. Open Browser Run in the Cloudflare dashboard (Compute → Browser Run) and confirm browser hours, active sessions, and close reasons match your expectations.

  2. On Workers Free, verify daily usage stays under 10 minutes; on Paid, compare dashboard totals with included 10 hours and concurrency averages using pricing and the X-Browser-Ms-Used header on Quick Actions.

  3. Call puppeteer.history() or playwright.history() in a test Worker and check that finished sessions show NormalClosure, not repeated BrowserIdle (Puppeteer).

  4. Trigger a low-risk Quick Action (for example /content) and confirm you do not receive HTTP 429; if you do, note Retry-After per limits.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page does not match your experience or the official docs, email yimasynthetic@gmail.com with the page URL and the exact statement you think is wrong so it can be corrected or clarified.