Build Wiz AI Show

AI Agent Sandboxes Explained: MicroVMs, gVisor and Containers

11 min · · English

Does every AI agent need its own computer? Bob and Alice unpack Josh Rosen's post on the state of the agent sandbox. In this episode: - MicroVMs, gVisor and containers: how isolation differs. - A restricted interpreter instead of a whole machine. - Snapshots, suspend-resume and shared workspaces. - Credentials, network allowlists and the lethal trifecta. Sources: Josh Rosen; Nicolas Lacasse; Anthropic; Simon Willison Big AI ideas, made clear for builders. luongnv.com/podcast

Listen on Build Wiz AI Show Download MP3 Transcript

Based on The State of the Agent Sandbox by Josh Rosen (@JoshARosen)

Transcript

Alice: Does every AI agent really need its own computer?

Bob: One company's answer: run agent code in a lightweight interpreter, instead of another isolated computer.

Alice: So what does a sandbox really need to be? Welcome to Build Wiz AI Show. Big AI ideas, made clear for builders. I'm Alice.

Bob: And I'm Bob! Today we unpack an X post by Josh Rosen called The State of the Agent Sandbox.

Alice: Sandboxes! Like at the playground? Little plastic shovels?

Bob: Close, actually! A sandbox lets an agent run code, install things and edit files, without unrestricted access to the machine underneath. And in the past year, they grew from simple places to run untrusted code into infrastructure for running entire agents.

Alice: And where's the race between providers?

Bob: Startup times, isolation, persistent filesystems, snapshots, and the ability to suspend and resume.

Alice: Let's start at the bottom. What's a sandbox's first job?

Bob: Isolation! Keep the agent's code away from the machine hosting it. Providers like E2B, Daytona, Modal, Vercel Sandbox and Cloudflare Sandboxes all offer similar tools: start an environment, run commands, swap files, and manage its lifecycle.

Alice: But the walls aren't all built the same, are they?

Bob: Not at all. Firecracker gives lightweight virtual machines, each with its own guest kernel, while gVisor is a user-space kernel that intercepts system calls. Plain containers share the host's kernel, which exposes a larger attack surface than a VM.

Alice: Kernel, system calls... you lost me. Can you picture it for a total beginner?

Bob: Picture an apartment building: containers are flats with separate doors, but they share the same plumbing, so one bad neighbour can mess with the pipes. A virtual machine is a detached house with its own plumbing. And gVisor is like a doorman who takes every request for you, so you never touch the building's pipes yourself.

Alice: A doorman. Fancy.

Bob: Very fancy. In computer terms, the plumbing is the kernel: programs make system calls to it, and it runs in a privileged mode that talks to the hardware.

Alice: Maya, our researcher, went back to how one of these walls was built.

Maya: Thanks, Alice. Nicolas Lacasse, a software engineer, introduced gVisor on the Google Cloud Blog. His headline: traditional Linux containers aren't sandboxes, because even with limits, the host kernel exposes a large surface that malicious apps can attack directly.

Alice: So why not give every container its own virtual machine?

Maya: Separate VMs give great isolation, the post says, but may need a larger resource footprint. gVisor aims for similar isolation while being lighter: its kernel runs as a normal, unprivileged process.

Alice: There's always a catch. What is it?

Maya: Higher overhead on every system call, and compatibility: not all applications will run inside gVisor.

Alice: Now, the teaser. A sandbox without a whole computer?

Bob: Right! Many agents only need short programs that chain tool calls. With Pydantic's Monty, the model writes Python that runs inside a restricted interpreter, and the app controls which functions that code can call, with resource limits.

Alice: Make it kitchen-simple for me.

Bob: Think of a set menu versus renting the whole kitchen. A full machine lets the cook use anything; the interpreter only cooks the dishes on the menu you printed. In software, that menu is the list of functions the app exposes.

Alice: So no surprise ingredients.

Bob: None! Monty can't install packages at will or run operating-system commands. Those limits are exactly why it needs far less infrastructure than a complete virtual machine.

Alice: Does it remember anything between runs?

Bob: It can. Sessions keep Python state across runs, and snapshots restore that state or fork it into independent sessions, without saving an entire operating system.

Alice: Snapshots. That's the next stop, right?

Bob: It is. Without persistence, every interruption means reinstalling dependencies, restoring files and restarting processes.

Alice: Who offers that today?

Bob: E2B supports pausing and resuming sandboxes, Daytona provides snapshots, and Modal offers persistent storage and filesystem snapshots. Memory snapshots can even keep running processes.

Alice: Okay, metaphor time!

Bob: It's like a save point in a video game: you reload right where you were, and branching copies that save into several slots to try a different path in each. For agents, several start from an identical environment, try different implementations, and each branch is validated before you keep one.

Alice: I'd have a save slot before every boss fight.

Bob: Me too. And startup speed matters: E2B and Daytona advertise startups in milliseconds or fractions of a second, under particular conditions.

Alice: Then why not keep them running all the time?

Bob: Cost. Agents spend a lot of time waiting, for the model, a human or other agents, not burning CPU. Keeping thousands of mostly idle sandboxes running can get expensive.

Alice: So what's the fix?

Bob: Think of closing your laptop lid instead of shutting it down: everything stays where you left it. Platforms such as Sprites from Fly dot io, and Blaxel, focus on environments that suspend when inactive and resume when needed, so you don't keep paying for active compute.

Alice: Security. If the agent's locked inside a microVM, we're safe. Right?

Bob: Not necessarily! An agent can run entirely inside a secure microVM and still access sensitive credentials, make unauthorized API requests, or leak information through an allowed network connection.

Alice: Wait. So the wall isn't enough?

Bob: No. Docker Sandboxes shows one fix, host-side credential injection: a proxy outside the agent's environment attaches the credential to approved requests, so the sandbox never reads the secret.

Alice: That one needs a picture.

Bob: Picture a hotel guest who wants dinner booked: the concierge calls the restaurant and pays with the card on file, and the guest never sees the card number. Here the concierge is the proxy, and the card number is the secret.

Alice: And who decides what the agent is allowed to do?

Bob: Network policies restrict which outside services it can reach, and authorization policies decide whether it can modify a repository or retrieve a customer record.

Alice: Lena, you looked at how a coding agent does this in practice?

Lena: I did. Anthropic's engineering post, Making Claude Code safer with sandboxing, says effective sandboxing needs both filesystem and network isolation. Without network isolation, a compromised agent could send out sensitive files like SSH keys; without filesystem isolation, it could escape the sandbox and gain network access.

Alice: So how does the network side actually work?

Lena: The agent reaches the internet only through a proxy server outside the sandbox, which limits the domains it can connect to and asks the user about new ones.

Alice: Same trick as our concierge! Last big idea: sandboxes as workspaces. What does that mean?

Bob: A sandbox can outlive the agent session that created it, so several agents share it. One agent changes a repository, a validation agent inspects the results, and a supervisor decides whether more work is needed.

Alice: Sounds like a crowded kitchen.

Bob: Exactly the risk! It's like two cooks salting the same pot of soup without talking. Two agents editing the same files can interfere, so ownership, locking and branching rules live outside any single agent.

Alice: So a lock is calling dibs on the pot.

Bob: Pretty much: one agent holds the file until it's done. And the work's own state, which task, what's finished, is tracked separately from the files.

Alice: And can we actually see what the agents did?

Bob: That's observability, like a dashcam for your agent: process activity, file changes and network requests help rebuild what it actually did. Pydantic's sandboxes connect to Logfire traces, and Daytona uses OpenTelemetry.

Alice: Time for counterpoints. Sam, you brought the skeptic's view.

Sam: I did. Simon Willison's post, The lethal trifecta for AI agents, warns about combining three things: access to your private data, exposure to untrusted content, and the ability to communicate externally. Combine all three, and an attacker can easily trick the agent into sending your data away.

Alice: So where does it go wrong?

Sam: The core problem: LLMs follow instructions in content, whether or not they came from their operator. And any tool that can make an HTTP request, even to load an image, can pass stolen information back.

Alice: Can't a guardrail product just catch the bad prompts?

Sam: He's deeply suspicious of those. In web application security, he writes, 95 percent is very much a failing grade. For people mixing tools together, his advice is to avoid the trifecta combination entirely.

Alice: That's a tough grading curve.

Bob: And Josh himself expects most of these capabilities to commoditize into standard features: they're already available in various forms across multiple providers.

Alice: My take: if everyone builds the same walls, the walls stop being the selling point. Builder's Corner! Bob, one thing listeners can try this week?

Bob: Run your agent's code in a sandbox with the network off by default, then allowlist only the services it truly needs. Josh's post says network policies restrict what an agent can reach, and Anthropic's post adds that filesystem isolation matters too.

Alice: And the secrets?

Bob: Keep them outside. Put a proxy in front that attaches the credential to approved requests, so the agent uses the service without reading the key. Then watch for network activity you didn't expect.

Alice: Network off, allowlist on, keys outside. Got it. Bob, the takeaways?

Bob: First, the walls differ: containers share a kernel, microVMs and gVisor don't. Second, not every agent needs a computer. Third, snapshots and suspend-resume save setup time and idle compute.

Alice: And fourth: a locked box can still leak, so guard the network and the keys. What's still open?

Bob: Josh's own question: will providers keep adding capabilities that change what agents can do, or will most of the innovation happen in the models, harnesses, tools and orchestration around them?

Alice: And Simon Willison's warning: we still don't know how to reliably prevent prompt injection.

Bob: That's our tour of the agent sandbox. Thanks to Josh Rosen for The State of the Agent Sandbox, and to Nicolas Lacasse on the Google Cloud Blog. Thanks also to Anthropic for Making Claude Code safer with sandboxing, and to Simon Willison for The lethal trifecta for AI agents.

Alice: Thanks, everyone! Keep your agents in the sandbox.

Bob: That's all for today on Build Wiz AI Show. Thanks for listening, and see you next time.