Quick Start
Setup E2B API Key
How It Works
E2B provides instant sandbox provisioning with pre-built environments, eliminating container startup time.Sandbox Management
Instant Provisioning
Code Execution
File Operations
LLM Integration
Common Patterns
Data Science Workflow
Web Scraping
API Testing
Configuration Options
E2B Configuration
| Option | Type | Default | Description |
|---|---|---|---|
template | str | "base" | E2B template to use |
timeout | int | 300 | Sandbox timeout in seconds |
memory | int | 512 | Memory limit in MB |
cpu | float | 1.0 | CPU limit (cores) |
Available Templates
| Template | Environment | Pre-installed |
|---|---|---|
base | Python 3.11 | python, pip, git |
python | Python 3.11 | numpy, pandas, matplotlib |
nodejs | Node.js 18 | node, npm, yarn |
ubuntu | Ubuntu 22.04 | Standard Linux tools |
Custom Templates
Best Practices
Choose the Right Template
Choose the Right Template
Use
base for general Python work. Use python template for data science with pre-installed packages. Create custom templates for repeated setups.Package Management
Package Management
Install packages once per sandbox session. E2B sandboxes persist packages during the session but reset between sessions.
Sandbox Lifecycle
Sandbox Lifecycle
E2B sandboxes auto-shutdown after timeout. Always call
shutdown_compute() to clean up resources and avoid charges.API Key Security
API Key Security
Store E2B_API_KEY securely. Never commit API keys to code. Use environment variables or secure secret management.
Related
Managed Agents
Overview of managed agent concepts
Modal Compute
Serverless compute environments

