Prime Radiant 开源编码智能体外置沙箱方案
Simon Willison 与 AI 研究实验室 Prime Radiant 合作提出“外置沙箱”模式:智能体本身运行在沙箱之外,其执行的代码则被隔离在专用沙箱内,从而降低本地模型试错与提示注入带来的破坏风险。团队同步开源三个沙箱服务实现,分别基于 v86 运行 WebAssembly 版 Alpine Linux、基于 Apple Containers 运行容器化 Alpine Linux 等方案。
报道正文
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:
- external-sandbox-v86 runs a Node.js server which then uses v86 to run Alpine Linux inside WebAssembly.
- external-sandbox-container is a Python web server which runs the sandbox in Alpine Linux inside an Apple Containers instance.
- external-sandbox-quicksand is another Python web server, this time using Microsoft's Quicksand sandboxing library, which bundles QEMU and Alpine Linux in a Python package!
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.
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