| layout | default |
|---|---|
| title | E2B Tutorial |
| nav_order | 200 |
| has_children | true |
| format_version | v2 |
Learn how to use
e2b-dev/E2Bto give AI agents secure, sandboxed cloud environments for code execution with sub-200ms cold starts.
When AI agents generate code, they need a safe place to run it. Local execution is dangerous --- an agent can delete files, exfiltrate data, or crash the host. E2B solves this by providing on-demand cloud sandboxes that spin up in under 200ms, run arbitrary code in full isolation, and tear down automatically.
This track focuses on:
- spinning up sandboxes and executing code securely from Python and TypeScript
- understanding the Firecracker microVM architecture that powers E2B
- managing filesystems, processes, and network access inside sandboxes
- building custom sandbox templates with pre-installed dependencies
- integrating E2B with LangChain, CrewAI, and other agent frameworks
- handling streaming output and real-time execution feedback
- operating E2B at scale in production AI applications
- repository:
e2b-dev/E2B - stars: about 11k
- latest docs: e2b.dev/docs
flowchart LR
A[AI Agent generates code] --> B[E2B SDK call]
B --> C[Sandbox spins up <200ms]
C --> D[Code executes in Firecracker microVM]
D --> E[Results stream back to agent]
E --> F[Sandbox auto-teardown]
F --> G[Agent reasons on output]
| Chapter | Key Question | Outcome |
|---|---|---|
| 01 - Getting Started | How do I spin up my first sandbox and run code? | Working baseline with Python and TypeScript SDKs |
| 02 - Sandbox Architecture | How does E2B achieve sub-200ms cold starts securely? | Strong mental model of Firecracker microVM isolation |
| 03 - Code Execution | How do I run code, handle errors, and capture output? | Reliable execution patterns for any language |
| 04 - Filesystem and Process Management | How do I read/write files and manage processes inside sandboxes? | Full control over sandbox state |
| 05 - Custom Sandbox Templates | How do I pre-install dependencies and tools? | Faster startup with custom environments |
| 06 - Framework Integrations | How do I connect E2B to LangChain, CrewAI, and other frameworks? | Agent framework code execution |
| 07 - Streaming and Real-time Output | How do I get live output from long-running executions? | Real-time feedback loops |
| 08 - Production and Scaling | How do I run E2B reliably at scale? | Production-grade deployment patterns |
- how to give AI agents secure code execution without risking your infrastructure
- how Firecracker microVMs provide true isolation with near-instant startup
- how to build custom sandbox templates for specialized workloads
- how to integrate E2B with popular agent frameworks
- how to stream execution output for interactive experiences
- how to operate sandboxes at scale with proper lifecycle management
- E2B Repository
- E2B Documentation
- E2B Python SDK
- E2B TypeScript SDK
- E2B CLI Reference
- E2B Custom Sandboxes
- E2B Cookbook
Start with Chapter 1: Getting Started.
- Start Here: Chapter 1: Getting Started
- Back to Main Catalog
- Browse A-Z Tutorial Directory
- Search by Intent
- Explore Category Hubs
- Chapter 1: Getting Started
- Chapter 2: Sandbox Architecture
- Chapter 3: Code Execution
- Chapter 4: Filesystem and Process Management
- Chapter 5: Custom Sandbox Templates
- Chapter 6: Framework Integrations
- Chapter 7: Streaming and Real-time Output
- Chapter 8: Production and Scaling
Generated by AI Codebase Knowledge Builder