Por ahora esta página solo está disponible en inglés.

How we sandbox AI agent computers with gVisor, warm sleep, and zero-wake file reads

Running an isolated Linux computer for every AI agent is easy on a whiteboard and expensive in production. Here is the exact architecture we use in Casama to keep per-bot sandboxes safe under gVisor, fast to wake, and readable while asleep.

By Oliver Martinez · Updated

Softly glowing translucent glass sanctuary domes resting on mossy twilight terraces, each holding a warm quiet study alcove while gentle cyan light ribbons drift overhead.

Bottom line

Casama isolates every AI teammate on its own gVisor-backed Linux container with a dedicated internal bridge network, fixed peer IPs for the egress proxy and supervisor, warm sleep that stops the container while preserving its home volume for ~1-second resumes, and zero-wake sleeping file reads through Docker's archive API so file previews and agent lookups never wake a parked sandbox.

1. Per-bot gVisor isolation with fixed-peer private networks

Standard Docker containers share the host Linux kernel. When an LLM generates arbitrary shell commands, installs npm or Python packages, or browses untrusted pages, a kernel-level escape or host network pivot is unacceptable.

Every Casama bot computer runs under gVisor (runsc) on its own internal Docker bridge network (Internal: true), with no direct internet route. Outbound HTTP/HTTPS traffic leaves only through our open-source egress proxy (infra/egress-proxy), which enforces per-bot domain rules and injects vaulted credentials on the wire so the model never sees raw secrets.

Under gVisor, Docker's embedded DNS does not always resolve peer services cleanly across deploys. When we create a bot's private network, we reserve deterministic low addresses in the subnet for its three peers — egress proxy (.0.2), supervisor (.0.3), and TURN relay (.0.4) — leave the upper half of the CIDR block to Docker's IPAM, and write /etc/hosts explicitly before the container starts. When a deploy recreates the supervisor or egress container, every running bot reconnects to the exact same fixed peer IP without dropping its session.

2. Warm sleep: ~1-second resume without cold tar restores

Early on, sleeping an idle computer meant archiving /home/casama into object storage, destroying the container, and restoring the tarball on the next message. That worked for long idle stretches, but waking a bot for a quick follow-up 10 minutes later paid a cold-restore penalty every time.

We split sleep into two tiers:

3. Zero-wake sleeping file reads

A surprising source of wasted sandbox wakes has nothing to do with running code: users opening the Files tab, previewing a PDF or spreadsheet a bot generated yesterday, or a bot checking a saved note before deciding what to do.

With zero-wake sleeping file reads, our supervisor reads files directly from a parked container's filesystem via Docker's archive stream (or falls back to the cold .tar.gz snapshot in object storage with a streaming tar scanner capped for safety). Listing directories, generating thumbnails, and previewing .pptx, .xlsx, .pdf, or .md artifacts all work in milliseconds while the bot's computer stays asleep.

4. What happens when Docker's bridge pool fills up

One real-world lesson from running hundreds of per-bot internal networks: Docker's default bridge address pool caps at 31 subnets unless expanded in daemon.json, and failed warm-pool starts can strand peer containers on orphaned networks. We run an orphan-network sweeper at startup and on demand whenever POST /networks/create hits subnet exhaustion, disconnecting only peer containers (egress, supervisor) from networks with no live or parked bot container attached.

Inspect the open parts

The computer daemon (dart/computerd), computer images (infra/images/computer), network egress guard (infra/egress-proxy), and safety rules (packages/safety) are open source on GitHub.

Questions

Why use gVisor instead of plain Docker containers for AI agents?

Plain Docker containers share the host Linux kernel, leaving a wide syscall attack surface if an agent runs untrusted code or falls for prompt injection. gVisor intercepts application syscalls in user space, giving each bot stronger kernel isolation while keeping fast container startup and warm-sleep compatibility.

Does a sleeping Casama computer consume compute hours?

No. Once a bot's computer enters warm sleep or cold sleep, it stops consuming compute hours while keeping its files and workspace state intact.

How can Casama preview files while a bot's computer is asleep?

The supervisor reads directly from the parked container via Docker's host-side archive API (or streams from the compressed snapshot in object storage if the computer is in cold sleep), so opening files or previews never wakes the sandbox.

Get Casama