Back to AI News
Simon Willison

External sandbox pattern released with three sandbox server implementations for coding agents

Simon Willison, working with Prime Radiant, introduced an external sandbox pattern in which code executed by an agent runs inside a dedicated sandbox while the agent itself stays outside it. Three implementations were released: external-sandbox-v86 (Node.js server running Alpine Linux via v86 in WebAssembly), external-sandbox-container (Python server using an Apple Containers instance), and external-sandbox-quicksand (Python server using Microsoft's Quicksand library with QEMU and Alpine Linux). All expose the same localhost API and can be configured for Pi, Claude Code, or Codex to route code execution to the sandbox. The sandboxes also include an optional HTTP/HTTPS allow-list proxy and a credential replacement mechanism for authenticated API calls without sharing secrets with the agent.

AI Brief

It gives developers concrete, open implementations and a reusable architecture for running coding-agent code safely, including network allow-listing and credential isolation.

External sandboxes for coding agents

I've been exploring new ways to sandbox code that is executed by agents, with a focus on making it safer to try out local models without worrying that a mistake or prompt injection attack might cause them to take damaging actions on a machine.

I worked on this project with Prime Radiant, the AI research lab behind Superpowers and other projects.

My post on the Prime Radiant blog introduces the external sandbox pattern, where code executed by the agent runs inside a dedicated sandbox while the agent itself lives outside of that sandbox.

To demonstrate this pattern we've released three sandbox server implementations:

Each of these implementations offers the same localhost API. You can then configure Pi, Claude Code, or Codex to send API calls to that sandbox any time they want to execute code.

The sandboxes also include an optional HTTP/HTTPS allow-list proxy, so you can control exactly which hosts your agent's code is allowed to communicate with - plus a credential replacement mechanism to make authenticated API calls without sharing a secret with the agent. Here's the UI you can use to reconfigure that proxy while the sandbox is still running:

The network policy page with allowed destinations, the policy JSON editor and recent proxy activity

I continue to be fascinated by the challenge of safely running untrusted code. This external sandbox pattern provides a neat way to experiment with different approaches.

Tags: sandboxing, security, ai, webassembly, generative-ai, llms, coding-agents, claude-code, codex, pi

Be the first to rate this article.

Comments & Questions (0)

Captcha
Please be respectful — let's keep the conversation friendly.

No comments yet

Be the first to comment!