Browsers
A headless Chromium for an agent, driven with Playwright or Puppeteer over the Chrome DevTools Protocol.
A machine running headless Chromium, driven over the Chrome DevTools Protocol at its preview on port 9222: one WebSocket address for Playwright's connectOverCDP and Puppeteer's connect, as Browserbase gives one. It pauses after 60 seconds with nothing happening, its memory kept, and a connection resumes it.
| Default | Value |
|---|---|
| vCPUs | 2 |
| Memory | 4 GB |
| Disk | 4 GB |
| Image | runtime/browsers |
| Pauses when idle | After 60 seconds |
POST /v2/browsers takes the same SandboxCreate as a sandbox; every field overrides a default above.
Connect to the browser#
Share port 9222 with a preview. Chromium's DevTools address answers there.
TypeScriptimport { Runtime } from "withruntime";const runtime = new Runtime();const browser = await runtime.browsers.create();try { const preview = (await runtime.previews.create(browser.id, { port: 9222 })).info; const open = () => fetch(`${preview.url}json/version`, { headers: { "x-runtime-preview-token": preview.token! } }); let answer = await open(); for (let i = 0; i < 40 && answer.status !== 200; i++) { await new Promise((r) => setTimeout(r, 250)); answer = await open(); } const version = await answer.json(); console.log(version.Browser); // Chrome/... if (!String(version.Browser).startsWith("Chrome/")) throw new Error(JSON.stringify(version));} finally { await browser.delete();}To drive it, pass the preview's address to Playwright's chromium.connectOverCDP(url, { headers }) or Puppeteer's puppeteer.connect, with the token in the x-runtime-preview-token header.
Next steps#
Give this to your agent#
Paste this into your coding agent:
Read https://withruntime.com/docs/browsers.md. Give this project's agent a Runtime browser: create one, share port 9222 with a preview, and connect Playwright with
chromium.connectOverCDPto the preview's url with its token in thex-runtime-preview-tokenheader. Delete the browser when the agent is done.This page as Markdown: https://withruntime.com/docs/browsers.md