# E2B — Cloud Sandboxes for AI Code Execution > Secure cloud sandboxes that let AI agents run code, install packages, and use the filesystem. Spin up in 150ms. Used by Vercel, Langchain, and CrewAI. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use ```bash npm install @e2b/code-interpreter ``` ```typescript import { Sandbox } from '@e2b/code-interpreter' const sandbox = await Sandbox.create() const result = await sandbox.runCode('print(1 + 1)') console.log(result.text) // "2" await sandbox.kill() ``` ## 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 ```python from e2b_code_interpreter import Sandbox sandbox = Sandbox() # Run Python with automatic package installation execution = sandbox.run_code( "import pandas as pd\\ " "import matplotlib.pyplot as plt\\ " "df = pd.DataFrame({\'x\': [1,2,3], \'y\': [4,5,6]})\\ " "df.plot()\\ " "plt.savefig(\'chart.png\')\\ " "print(df.describe())" ) print(execution.text) # stdout print(execution.results) # rich outputs (charts, tables) ``` ### 2. Custom Sandbox Templates ```dockerfile # e2b.Dockerfile FROM e2b/base RUN pip install numpy pandas scikit-learn RUN npm install -g typescript ``` ```bash e2b template build --name "data-science" ``` ### 3. Filesystem Access ```python # 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 ```python # 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 ```python # 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 E2BCodeInterpreterTool ``` ## Use 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. ## Source & Thanks - GitHub: [e2b-dev/e2b](https://github.com/e2b-dev/e2b) (10k+ stars) - Docs: [e2b.dev/docs](https://e2b.dev/docs) ## Quick Start ```bash npm install @e2b/code-interpreter ``` Three lines of code spin up a secure cloud sandbox for AI agents to execute code. ## What is E2B? E2B provides securely isolated cloud sandboxes (micro-VMs) that boot in 150ms, giving AI agents full Linux environments to execute code. **In one sentence**: E2B provides secure cloud sandboxes that start in 150ms, letting AI agents safely execute code, install packages, and access the filesystem. ## Core Features ### 1. Code Interpreter SDK Run Python/JS code with automatic dependency installation. ### 2. Custom Templates Preinstall tools and packages with a Dockerfile. ### 3. Filesystem Upload and download files with full filesystem operations. ### 4. Long-Running Sessions Supports pause/resume with up to 24-hour lifetime. ## FAQ **Q: Is it secure?** A: Each sandbox is an isolated Firecracker micro-VM. **Q: Pricing?** A: 100 sandbox-hours per month are free; additional usage is pay-as-you-go. ## Source & Thanks - GitHub: [e2b-dev/e2b](https://github.com/e2b-dev/e2b) (10k+ stars) --- Source: https://tokrepo.com/en/workflows/e2b-cloud-sandboxes-ai-code-execution-652da886 Author: E2B