What is E2B?
E2B provides secure, isolated cloud sandboxes for AI agents to execute code. Each sandbox is a micro-VM that spins up in ~150ms with a full Linux environment — perfect for code interpreters, data analysis agents, and AI-generated code execution.
Answer-Ready: E2B provides secure cloud sandboxes (micro-VMs) that spin up in 150ms for AI agents to execute code, install packages, and access filesystems safely.
Core Features
1. Code Interpreter SDK
from e2b_code_interpreter import Sandbox
sandbox = Sandbox()
# Run Python with automatic package installation
execution = sandbox.run_code(
"import pandas as pd\\n"
"import matplotlib.pyplot as plt\\n"
"df = pd.DataFrame({\'x\': [1,2,3], \'y\': [4,5,6]})\\n"
"df.plot()\\n"
"plt.savefig(\'chart.png\')\\n"
"print(df.describe())"
)
print(execution.text) # stdout
print(execution.results) # rich outputs (charts, tables)2. Custom Sandbox Templates
# e2b.Dockerfile
FROM e2b/base
RUN pip install numpy pandas scikit-learn
RUN npm install -g typescripte2b template build --name "data-science"3. Filesystem Access
# Upload files
sandbox.files.write("/home/user/data.csv", csv_content)
# Download results
content = sandbox.files.read("/home/user/output.json")
# List files
files = sandbox.files.list("/home/user/")4. Long-Running Sandboxes
# Keep alive for up to 24 hours
sandbox = Sandbox(timeout=3600) # 1 hour
# Pause and resume
sandbox_id = sandbox.pause()
# ... later ...
sandbox = Sandbox.resume(sandbox_id)5. Framework Integrations
# OpenAI Assistants
from e2b_code_interpreter import Sandbox
# Use as code_interpreter tool handler
# Vercel AI SDK
# Built-in e2b sandbox support
# LangChain
from langchain_e2b import E2BCodeInterpreterToolUse Cases
| Use Case | Example |
|---|---|
| Code Interpreter | ChatGPT-like code execution |
| Data Analysis | Run pandas/matplotlib in sandbox |
| CI/CD | Test AI-generated code safely |
| Education | Student code execution |
FAQ
Q: How secure are the sandboxes? A: Each sandbox is an isolated Firecracker micro-VM with no network access to other sandboxes.
Q: Pricing? A: Free tier with 100 sandbox hours/month. Pay-as-you-go after that.
Q: Supported languages? A: Any language that runs on Linux — Python, Node.js, Go, Rust, etc.