ScriptsMar 31, 2026·2 min read

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
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

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.


Intro

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.


🙏

Source & Thanks

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

Related Assets