cpuos

Integration · Tool

Playwright with cpuos sandboxes

Run Playwright and headless Chromium for browser agents inside a disposable microVM, using the cpuos Browser template.

SDK
@cpuos/sdk · pip install cpuos
Model endpoint
https://gpuos.si/v1 or any OpenAI-compatible
Status
Early access

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

TypeScript
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

Questions

Can I use Playwright for Python?
The template ships Playwright with Chromium. If you prefer the Python bindings, install them in the sandbox or build a custom template with them preinstalled.
Headless or headed?
Headless for agents. The live view is there to debug or to let a person watch and take over.
Can the browser reach my internal apps?
Not through private IP ranges, which cpuos always blocks. Test internal apps by deploying a copy into the sandbox or exposing a public staging URL.

Related

Run Playwright tool calls in a sandbox

cpuos is in early access: a Firecracker microVM per task, hosted in the EU or on your servers, billed per second and free while paused.

gpuOS · where models think

Need the model too? Run it on gpuOS

gpuOS serves open models on your own GPUs behind one OpenAI-compatible API. The model reasons on gpuOS, the agent acts in a cpuOS sandbox.