The Browser template
The browser template ships Chromium, Playwright, a CDP endpoint and a live view, snapshotted after start so a new sandbox is ready in about 650 ms. Pages, downloads and cookies live and die with the sandbox.
Run a Playwright script the model wrote
import { Sandbox } from "@cpuos/sdk"const script = `import { chromium } from "playwright"const browser = await chromium.launch()const page = await browser.newPage()await page.goto("https://playwright.dev")await page.screenshot({ path: "/work/home.png" })console.log(await page.title())await browser.close()`const sbx = await Sandbox.create({ template: "browser", timeout: "10m" })await sbx.files.write("/work/task.mjs", script)const run = await sbx.exec("node /work/task.mjs", { timeout: "2m" })console.log(run.exitCode, run.stdout)const png = await sbx.files.read("/work/home.png")await sbx.pause()Wrap the last part in a tool ("run this Playwright script, return stdout and the screenshot") and the model can browse in a loop, fixing selectors from the error messages.
cpuos is in early access: @cpuos/sdk (npm) and cpuos (PyPI) ship to early-access teams first, and read the API key from CPUOS_API_KEY. The calls on this page show the current API shape.
End-to-end tests of what the agent built
A coding agent can build an app in the node or devbox template, start it with exec(..., { background: true }), and run its Playwright tests against localhost inside the same sandbox. Return the test report to the model, and sbx.url(port) to the user for a live preview.
The full guide covers step-by-step browsing and hardening: A browser automation sandbox for AI agents. To read screenshots, the model needs vision: gpuOS serves a vision model on your own GPU behind the same OpenAI-compatible API as text models.
Official documentation: playwright.dev