What is E2B?
E2B is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our JavaScript SDK or Python SDK.
Run your first Sandbox
1. Install SDK
pip install e2b
2. Get your E2B API key
E2B_API_KEY=e2b_***
3. Start a sandbox and run commands
from e2b import Sandbox
with Sandbox.create() as sandbox:
result = sandbox.commands.run('echo "Hello from E2B!"')
print(result.stdout) # Hello from E2B!
4. Bind the configuration to a client
The top-level Sandbox, AsyncSandbox, Volume, AsyncVolume, Template, AsyncTemplate and Secret exports read their configuration from the environment variables. To use an explicit configuration — e.g. several API keys or domains in one process — create an E2B client and use the resource classes it exposes:
from e2b import E2B
client = E2B(api_key="e2b_***", domain="e2b.dev")
sandbox = client.Sandbox.create()
volume = client.Volume.create("my-volume")
exists = client.Template.exists("my-template")
secret = client.Secret.create("openai-api-key", "sk-***")
# The async variants are exposed as well.
async_sandbox = await client.AsyncSandbox.create()
# The classes can be assigned and used like the top-level ones.
Sandbox = client.Sandbox
paginator = Sandbox.list()
Per-call params still take precedence over the client's params, and clients are isolated from each other and from the env-configured top-level exports.
5. Code execution with Code Interpreter
If you need run_code(), install the Code Interpreter SDK:
pip install e2b-code-interpreter
from e2b_code_interpreter import Sandbox
with Sandbox.create() as sandbox:
execution = sandbox.run_code("x = 1; x += 1; x")
print(execution.text) # outputs 2
6. Check docs
Visit E2B documentation.
7. E2B cookbook
Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file e2b-2.45.0.tar.gz.
File metadata
- Download URL: e2b-2.45.0.tar.gz
- Upload date:
- Size: 227.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95c93f9b48a0a793fbd43d8496a05ee10e5e3cf394c2d044e169d228136175d2
|
|
| MD5 |
39c87aedb048a948bd7ee332fb0f1a89
|
|
| BLAKE2b-256 |
8863692157fa765cbc10fc30a3c601533d1fdcf60b20db6f690493647ea14e5f
|
File details
Details for the file e2b-2.45.0-py3-none-any.whl.
File metadata
- Download URL: e2b-2.45.0-py3-none-any.whl
- Upload date:
- Size: 401.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc69c9ba72dea63e4bc927655d379c4967b15ce3af7b442d17e131cf2dae6699
|
|
| MD5 |
812e662378a63eb0b7050b6409d3975d
|
|
| BLAKE2b-256 |
b98325fe5f56d75acff5c6978f29f88f4f89848d5396f6ff383c95a37b6ede91
|