CodeRunner 帮助你将 AI 代理及其操作安全地隔离在沙箱中。
关键用例: 你可以在我们的沙箱中运行多个 Claude Code 或 AI 代理,无需担心数据丢失和外泄。
前置要求: Mac(macOS 和 Apple Silicon (M1/M2/M3/M4)),Python 3.10+
git clone https://github.com/instavm/coderunner.git
cd coderunner
chmod +x install.sh
./install.sh
完成后停止沙箱:
container stop coderunner
稍后恢复同一个沙箱,上传文件、内核和已安装的软件包都会保留:
container start coderunner
如需用全新沙箱重新开始,请删除容器并重新运行安装程序:
container delete coderunner && ./install.sh
./install.sh(如果尚未完成)
container exec -it coderunner /bin/bash
root@coderunner:/app# npm install -g @anthropic-ai/claude-code
MCP 服务器将在以下地址可用:http://coderunner.local:8222/mcp
安装所需软件包(使用 virtualenv 并注意 python 路径):
pip install -r examples/requirements.txt



复制示例配置:
cd examples
cp claude_desktop/claude_desktop_config.example.json claude_desktop/claude_desktop_config.json
编辑配置文件并替换占位符路径:
/path/to/your/python 替换为你的实际 Python 路径(例如 /usr/bin/python3 或 /opt/homebrew/bin/python3)/path/to/coderunner 替换为你克隆仓库的实际路径编辑后的示例:
{
"mcpServers": {
"coderunner": {
"command": "/opt/homebrew/bin/python3",
"args": ["/Users/yourname/coderunner/examples/claude_desktop/mcpproxy.py"]
}
}
}
更新 Claude Desktop 配置:
快速开始:
# 1. Install and start CodeRunner (one-time setup)
git clone https://github.com/instavm/coderunner.git
cd coderunner
sudo ./install.sh
# 2. Install the Claude Code plugin
claude plugin marketplace add https://github.com/instavm/coderunner-plugin
claude plugin install instavm-coderunner
# 3. Reconnect to MCP servers
/mcp
安装步骤:
进入插件市场:

添加 InstaVM 仓库:

使用 Claude Code 执行 Python 代码:

就这样!Claude Code 现在可以使用所有 CodeRunner 工具:
了解更多: 有关详细文档,请参阅插件仓库。

创建或编辑 ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"coderunner": {
"type": "remote",
"url": "http://coderunner.local:8222/mcp",
"enabled": true
}
}
}
保存配置后:

设置你的 OpenAI API 密钥:
export OPENAI_API_KEY="your-openai-api-key-here"
运行客户端:
python examples/openai_agents/openai_client.py
开始编码: 输入类似“写一段 Python 代码生成 100 个质数”的提示词,然后看着它在沙箱中安全执行!
Gemini CLI 是 Google 最近推出的工具。
{
"theme": "Default",
"selectedAuthType": "oauth-personal",
"mcpServers": {
"coderunner": {
"httpUrl": "http://coderunner.local:8222/mcp"
}
}
}


Kiro 是 Amazon 最近推出的产品。
{
"mcpServers": {
"coderunner": {
"command": "/path/to/venv/bin/python",
"args": [
"/path/to/coderunner/examples/claude_desktop/mcpproxy.py"
],
"disabled": false,
"autoApprove": [
"execute_python_code"
]
}
}
}

Coderunner-UI 是我们自有的离线 AI 工作区工具,专为完全隐私和本地处理而设计。

代码在具有虚拟机级隔离的独立容器中运行。你的主机系统和沙箱之外的文件仍受到保护。
来自 @apple/container:
每个容器都具有完整 VM 的隔离特性,使用最少的核心工具和动态库来降低资源占用和攻击面。
CodeRunner 内置技能系统,为常见任务提供预打包工具。技能分为两类:
以下技能包含在每次 CodeRunner 安装中:
技能通过 MCP 工具访问:
# List all available skills
result = await list_skills()
# Get documentation for a specific skill
info = await get_skill_info("pdf-text-replace")
# Execute a skill's script
code = """
import subprocess
subprocess.run([
'python',
'/app/uploads/skills/public/pdf-text-replace/scripts/replace_text_in_pdf.py',
'/app/uploads/input.pdf',
'OLD TEXT',
'NEW TEXT',
'/app/uploads/output.pdf'
])
"""
result = await execute_python_code(code)
用户可以将自己的技能添加到 ~/.coderunner/assets/skills/user/ 目录:
my-custom-skill/)SKILL.md 文件scripts/ 子目录中添加你的脚本list_skills() 工具自动发现技能结构:
~/.coderunner/assets/skills/user/my-custom-skill/
├── SKILL.md # Documentation with usage examples
└── scripts/ # Your Python/bash scripts
└── process.py
# Inside the container, execute:
python /app/uploads/skills/public/pdf-text-replace/scripts/replace_text_in_pdf.py \
/app/uploads/tax_form.pdf \
"John Doe" \
"Jane Smith" \
/app/uploads/tax_form_updated.pdf
CodeRunner 由以下部分组成:
examples/ 目录包含:
openai-agents - OpenAI agents 集成示例claude-desktop - Claude Desktop 集成示例https://github.com/apple/container/blob/main/docs/tutorial.md
我们欢迎贡献!请参阅 CONTRIBUTING.md 了解相关指南。
本项目采用 Apache 2.0 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。
开始在 Claude 中使用 CodeRunner: 现在你可以让 Claude 执行代码,它会在沙箱中安全运行!