Scripts2026年3月31日·1 分钟阅读

E2B — Secure Sandboxes for AI Code Execution

Open-source cloud sandboxes for AI agents to execute code safely. Isolated Linux environments with filesystem, networking, and process control. 11.5K+ stars.

TO
TokRepo精选 · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

pip install e2b-code-interpreter
from e2b_code_interpreter import Sandbox

with Sandbox() as sandbox:
    execution = sandbox.run_code("print('Hello from sandbox!')")
    print(execution.text)

Get API key at e2b.dev.


介绍

E2B provides open-source, secure cloud sandboxes for AI agents to execute code safely. Each sandbox is an isolated Linux environment with its own filesystem, networking, and process control — spun up in ~150ms. Used by major AI companies for code execution in chatbots, coding agents, and data analysis pipelines. 11,500+ GitHub stars, Apache 2.0.

Best for: AI applications that need to execute user or AI-generated code safely Works with: OpenAI, Anthropic, LangChain, CrewAI, AutoGen, any agent framework


Key Features

Instant Sandboxes

Spin up isolated Linux environments in ~150ms. Each sandbox runs in its own microVM.

Code Interpreter SDK

Execute Python, JavaScript, R, Java, and more with output capture:

result = sandbox.run_code("""
import matplotlib.pyplot as plt
plt.plot([1,2,3], [4,5,6])
plt.savefig('chart.png')
""")
# result.artifacts contains the chart image

Filesystem & Networking

Full Linux filesystem, install packages, make HTTP requests, run servers inside the sandbox.

Custom Templates

Pre-configure sandboxes with specific languages, packages, and tools.

Security

Isolated microVMs — no access to host system. Auto-terminate after timeout.


FAQ

Q: What is E2B? A: Secure cloud sandboxes for AI code execution. Isolated Linux environments that spin up in 150ms. Used for AI chatbots, coding agents, and data analysis. 11.5K+ stars.

Q: Is E2B free? A: Free tier with 100 sandbox hours/month. Open-source self-hosting available.


🙏

来源与感谢

Created by E2B. Licensed under Apache 2.0. e2b-dev/e2b — 11,500+ GitHub stars

相关资产