Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
This is an old revision of the document!
E2B (pronounced “edge-to-backend”) is an open-source infrastructure platform that provides secure, isolated cloud sandboxes for running AI-generated code. Built on Firecracker microVMs (the same technology behind AWS Lambda), E2B enables AI agents to execute arbitrary code safely without risking the host system. With 11,000+ GitHub stars, $21M in Series A funding, and adoption by Fortune 100 companies, it has become the standard for sandboxed code execution in agentic AI systems.
E2B's architecture centers on Firecracker microVMs for hardware-level isolation:
The Code Interpreter SDK is E2B's primary interface, launching Jupyter servers inside sandboxes for LLMs to execute code:
pip install e2b-code-interpreter) and JavaScript (npm install @e2b/code-interpreter)Sandbox.create() provisions a new Firecracker microVM in under 200mssandbox.run_code() sends code to the Jupyter kernel inside the sandboxfrom openai import OpenAI from e2b_code_interpreter import Sandbox # Create OpenAI client for code generation client = OpenAI() # Define the task system_prompt = ( "You are a data analyst. Write Python code to answer questions. " "Only output executable code, no explanations." ) user_prompt = "Generate a bar chart of the top 5 programming languages by popularity in 2025." # Get code from LLM response = client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, ], ) code = response.choices[0].message.content # Execute in secure E2B sandbox with Sandbox() as sandbox: # Install dependencies sandbox.run_code("!pip install matplotlib") # Run the generated code execution = sandbox.run_code(code) print("Output:", execution.text) # Check for errors if execution.error: print(f"Error: {execution.error.name}: {execution.error.value}") # Access generated files (e.g., chart images) for artifact in execution.results: print(f"Generated: {artifact}")
┌──────────────┐ ┌──────────────┐
│ AI Agent │ │ LLM API │
│ (your app) │◄───▶│ (GPT-4o, │
└──────┬───────┘ │ Claude) │
│ └──────────────┘
│ E2B SDK
│
┌──────▼─────────────────────────────┐
│ E2B Cloud Platform │
│ │
│ ┌──────────────────────────────┐ │
│ │ Firecracker MicroVM │ │
│ │ ┌────────────────────────┐ │ │
│ │ │ Jupyter Server │ │ │
│ │ │ ┌──────────────────┐ │ │ │
│ │ │ │ Python Kernel │ │ │ │
│ │ │ │ (code execution)│ │ │ │
│ │ │ └──────────────────┘ │ │ │
│ │ │ ┌──────────────────┐ │ │ │
│ │ │ │ Filesystem │ │ │ │
│ │ │ └──────────────────┘ │ │ │
│ │ └────────────────────────┘ │ │
│ │ Isolated: CPU | RAM | Net │ │
│ └──────────────────────────────┘ │
└────────────────────────────────────┘