Simon Willison 演示外部沙箱模式:让 Claude Code 等编码智能体安全执行代码
如果你在 Mac 上跑 Claude Code 或 Codex,又怕智能体生成的代码搞坏本机,这篇文章给了三种现成的沙箱方案和配置演示,比直接裸跑安全,也比整个虚机轻便。
Simon Willison 分享了一种外部沙箱模式:编码智能体本体运行在本地 Mac 上,但它生成的代码被隔离到外部沙箱中执行。沙箱方案包括 WebAssembly、QEMU 和 Apple Container 三种容器/虚拟化技术。
文中为 Claude Code、Codex 和 Pi 三个编码智能体分别提供了演示,展示如何配置它们把代码执行环节导向外部沙箱。这种架构让智能体保留本地文件读写和任务规划能力,同时把不可信的代码运行限制在隔离环境里,降低执行恶意或错误代码破坏系统的风险。
对于在本地机器上运行编码智能体又担心安全隔离的开发者,这一模式提供了比全虚拟机更轻量的折中方案。
I've been exploring new ways to sandbox code written by coding agents - here's a description of the external sandbox pattern, where agents run on your Mac but execute code in a WebAssembly or QEMU or Apple Container sandbox - with demos for Claude Code, Codex and Pi blog.primeradiant.com/external-sandb…📊 11 ⚡
This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include Claude Code, Codex, sandbox, WebAssembly.
Source attribution: curated from Simon Willison (@simonw).