e2b-dev/E2B
Open-source, secure environment with real-world tools for enterprise-grade agents.
E2B – Secure Cloud Sandboxes for AI‑generated Code
What it is – E2B (e2b.dev) is an open‑source platform that lets you spin up isolated, cloud‑hosted sandboxes and run code that has been generated by AI models. It provides language‑specific SDKs (Python and JavaScript/TypeScript) so you can start a sandbox, execute shell commands, run snippets of code, or control a full desktop environment – all from your own application.
Why it matters – Large language models (LLMs) often need a safe place to execute the code they produce. E2B gives developers a ready‑made, security‑focused runtime that can be accessed via simple API calls, removing the need to build and maintain custom VM or container orchestration for each request.
Core capabilities
| Feature | Description |
|---|---|
| Sandbox lifecycle | Sandbox.create() starts a fresh, isolated environment; the sandbox can be used with a context manager (Python) or await pattern (JS). |
| Command execution | Run arbitrary shell commands (sandbox.commands.run('...')) and get stdout/stderr back. |
| Code interpreter | Dedicated SDK (@e2b/code‑interpreter / e2b-code-interpreter) to evaluate snippets in supported languages (e.g., JavaScript, Python) and return results. |
| Desktop interaction | With the Desktop SDK you can launch GUI apps, move the mouse, type, take screenshots, and stream the desktop – useful for agents that need visual feedback. |
| Multi‑cloud deployment | The runtime can be self‑hosted on AWS, GCP, Azure, or any Linux machine via Terraform‑managed infrastructure. |
| SDKs & docs | Packages on PyPI and npm, plus extensive docs and a cookbook of example integrations with LLMs and AI frameworks. |
Typical use cases
- LLM‑driven agents that need to run generated scripts safely (e.g., data cleaning, file manipulation).
- AI‑assisted coding tools that compile and test snippets on the fly without exposing the host system.
- Automation bots that interact with a GUI (open a browser, click, screenshot) as part of a reasoning loop.
- Research prototypes requiring reproducible, isolated execution environments for each model inference.
Quick start (Python)
pip install e2b # install SDK
export E2B_API_KEY=e2b_... # set your key
from e2b import Sandbox
with Sandbox.create() as sandbox:
# run a shell command
result = sandbox.commands.run('echo "Hello from E2B!"')
print(result.stdout) # → Hello from E2B!
# run a code snippet
exec_res = sandbox.run_code('x = 5; x * 2')
print(exec_res.text) # → 10
A similar flow exists for JavaScript/TypeScript using npm i e2b.
Self‑hosting
If you prefer not to rely on the hosted service, the repository includes an embed deployment guide. The runtime is packaged as a Terraform module that can be provisioned on any of the supported clouds or on a bare‑metal Linux server.
License & community
The core E2B SDKs are released under the MIT license. The project is maintained by the e2b-dev organization and links to a cookbook repository with community‑contributed examples.
Bottom line – E2B provides a ready‑to‑use, secure execution layer for AI‑generated code, letting developers focus on the reasoning part of their agents while the platform handles sandbox creation, isolation, and cross‑cloud deployment.
Related
- Project
- Project
- Project
- Project
- Project