← All writing

AI Engineering

External Sandboxes: Keep Coding Agents Off Your Mac

Mani G 3 min read

A robot coding agent at a laptop sends commands through a cable into a locked glass box holding a Linux terminal and folders, with outside network lines blocked.

Letting a coding agent run commands on your laptop is a bit like handing your house keys to a very fast intern who never gets tired and sometimes believes a stranger's sticky note. External sandboxes are a new pattern for fixing that. The agent keeps running on your machine, but every command it executes goes to a separate, locked-down Linux box that only sees the folders and websites you allow.

Simon Willison and the research lab Prime Radiant named the pattern and released three working prototypes this week. I think it is one of the more sensible agent safety ideas of the year, mostly because it doesn't rely on a model behaving.

What external sandboxes actually are

There are two ways to put an agent in a sandbox. You can put the whole agent inside it, which is how systems like Fly's Sprites work. Or you can leave the agent outside and have it send its commands in. Willison and Prime Radiant picked the second. Their reasoning: an agent living inside its sandbox can end up changing itself or its own surroundings, while a clean line between "the agent" and "where code runs" is easier to audit.

The name trips people up, so here is the plain version. The sandbox is external to the agent, not to your computer. Both can sit on the same Mac.

The defaults are strict:

  • The sandbox only sees folders you mount, read-only or read-write.
  • No network at all unless you turn on a proxy, and then only to hosts you list, with the HTTP methods you allow.
  • API keys stay outside. The proxy swaps a placeholder token for the real one on the way out, so the agent never sees the secret.
  • A web UI gives you a terminal, the network rules and a log of every request allowed or blocked.

Three sandboxes, one protocol

The part I like most is that there are three separate implementations speaking the same localhost API:

  • external-sandbox-v86 runs Alpine Linux inside v86, an x86 emulator compiled to WebAssembly, from Node.js.
  • external-sandbox-container wraps Apple Containers from Python.
  • external-sandbox-quicksand runs a full QEMU virtual machine through Microsoft's Quicksand, with QEMU and Alpine shipped as Python wheels.

Claude Code, Codex and Pi can each talk to any of them. There is a written spec and a conformance test tool, so someone can build a fourth sandbox on another stack. A protocol that ships with its own tests is rare enough that I'll take it.

A quick example

Say you want to try a cheap local model on a side project, but you don't trust it near your SSH keys. You start the v86 sandbox from your project folder with one npx command, mounting only that folder. Then you start Pi pointed at the sandbox URL with its built-in tools switched off. Run !uname -a and you get Linux back, not macOS.

The agent can now build and test your code. If a prompt injection hidden in some README tells it to upload ~/.aws, there is no ~/.aws inside the box to find, and no open network route to send it anywhere.

The catches

These are labelled experimental prototypes, not audited for sensitive work. A read-write mount still lets the agent wreck that folder, so keep it in git. Claude Code only routes its Bash tool through the sandbox; its own Read and Edit tools still touch your Mac directly. And because the guest is Linux, a macOS-built node_modules or .venv may need reinstalling inside.

Still, the core argument holds up. Claude Code's auto mode and Codex's auto-review use extra AI checks to decide when an action looks safe. Those help, but they still depend on a model judging each action correctly. A sandbox doesn't care how persuasive the attacker's prompt was.

One detail that surprised me: the v86 option boots a full Linux distribution inside WebAssembly, packaged on npm. Would you run your agent's commands in an emulator if it meant your home folder was off-limits?

Sources: Prime Radiant: External sandboxes for coding agents, Simon Willison's link post, external-sandbox on GitHub.