Run untrusted AI-generated code inside secure E2B sandboxes
Create disposable E2B cloud sandboxes where agents can execute generated code, install dependencies, collect outputs, and discard state safely.
Prerequisites
E2B account/API key; Python or JavaScript SDK; optional e2b-code-interpreter package
Installation
Use the upstream install or setup path that matches your environment:
- npm i e2b
- pip install e2b
- npm i @e2b/code-interpreter # JavaScript/TypeScript
- pip install e2b-code-interpreter # Python
Requirements and caveats from upstream:
- <img alt="Last 1 month downloads for the Python SDK" loading="lazy" decoding="async" style="color:transparent;width:170px;height:18px" src="https://static.pepy.tech/personalized-badge/e2b?period=monthly&units=INTERNAT...
- Python
Basic usage or getting-started notes:
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](https://www.npm...
Run your first Sandbox
3. Start a sandbox and run commands
Source: https://github.com/e2b-dev/E2B
Extracted from upstream docs: https://raw.githubusercontent.com/e2b-dev/E2B/HEAD/README.md