Runtime

What is a headless browser?

A headless browser is a real web browser run without a window, controlled by code, for tests, scraping, screenshots and AI agents.

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

Headless and headed

Chrome's documentation puts it plainly: "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 lives on as chrome-headless-shell. Playwright runs tests headless by default (--headed shows the window) and uses that lighter shell for headless Chromium 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 Firefox, live view and recording

Why AI agents use one

An agent that reads documentation, checks a deployed app or fills a form needs a browser that code can drive and that renders JavaScript. Running it on your own server hands untrusted pages your network; running it in a sandbox keeps those pages behind the sandbox's egress rules, with private and internal addresses always refused.

Agents that plan from pixels use a headed desktop and computer use. Agents that act through the page's structure, 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);

Ask for 8 GiB of disk: Chromium and its libraries take a large share of the default 4 GiB. Put the install in a custom image and later sandboxes start with the browser ready.

Sources

Facts on this page were checked on 25 September 2026.