Skip to content
Runtime

What is a headless browser?

A headless browser is a real web browser that runs without a window. Code controls it. It is used for tests, scraping, screenshots and AI agents.

On Runtime, each headless browser gets a Linux microVM of its own. Parallel runs never share cookies, a profile or a kernel. You pay only for the CPU the browser uses. Playwright's Chromium installs in two commands on the stock Ubuntu 24.04 image (the sandbox environment).

Headless and headed

The Chrome documentation describes the mode this way: "With Chrome Headless mode, you can run the browser in an unattended environment, without any visible UI." Since Chrome 112, headless and headed Chrome share one implementation. The older separate build is still available as chrome-headless-shell. Playwright runs tests headless by default. Pass --headed to show the window. For headless Chromium, Playwright uses the lighter shell, unless you opt into the full browser with the chromium channel.

Mode What it is On Runtime
Headless shell Lightweight Chromium build, no display Playwright's default headless Chromium, via exec
New headless (chromium channel) Full Chrome with no window The same install, channel: "chromium"
Headed A visible browser on a desktop The sandbox desktop with Chromium, live view and recording

Why AI agents use one

An agent that reads documentation, checks a deployed app or fills in a form needs a browser. Code must be able to drive that browser, and the browser must render JavaScript. Running it on your own server gives untrusted pages access to your network. Running it in a sandbox keeps those pages behind the sandbox's egress rules. Private and internal addresses are always refused.

Agents that plan from pixels use a headed desktop and computer use. Agents that act through the page's structure, by clicking selectors and reading text, are faster and cheaper with a headless browser.

Run one

Terminalsudo npx playwright install-deps chromiumnpx playwright install chromium
TypeScriptimport { Sandbox } from "withruntime";const script = `const { chromium } = require("playwright");(async () => {  const browser = await chromium.launch({ headless: true });  const page = await browser.newPage();  await page.goto("https://example.com");  console.log(await page.title());  await browser.close();})();`;await using sbx = await Sandbox.create({ diskMiB: 8192 });const slow = { check: true, timeoutMs: 600_000 } as const;await sbx.exec("npm install --no-fund --no-audit playwright", slow);await sbx.exec("sudo npx playwright install-deps chromium", slow);await sbx.exec("npx playwright install chromium", slow);await sbx.files.write("/workspace/title.cjs", script);console.log((await sbx.exec(["node", "title.cjs"], { check: true })).stdout);

Request 8 GiB of disk. Chromium and its libraries take a large share of the default 4 GiB. To start later sandboxes with the browser ready, put the install in a custom image.

Sources

Facts on this page were checked on 25 October 2026.

100 free hoursin your first 30 days.

of a 1 GB machine

  • No credit card
  • Four sandboxes at once, 2 vCPU and 4 GiB each
  • Then prepaid credit from $10, no plan fee
Start free, no card
Start free, no card