Open-source infrastructure for running AI-generated code in isolated cloud sandboxes, with JavaScript and Python SDKs.
e2b-dev/code-interpreter
Python and JS/TS SDKs for running AI-generated code in isolated cloud sandboxes and reading back its output.
- Stars
- 2,421
- Forks
- 233
- Open issues
- 27
- Last commit
- yesterday
What is it?
E2B Code Interpreter is an SDK that lets AI applications execute code they generate inside secure, isolated cloud sandboxes. Developers create a sandbox from Python or JavaScript/TypeScript, run code in it, and read back the results and printed output.
The sandbox keeps state between calls, so a variable set in one run (for example, x = 1) is still available in the next. This makes it suitable for multi-step workflows such as data analysis driven by an LLM. The project is the Python and JS SDK layer; sandbox templates for customizing packages and runtimes are included in the repository.
The SDK sources have moved to the E2B monorepo, and this repository keeps the sandbox template and a chart data extractor.
Key features
- 01Runs AI-generated code in isolated cloud sandboxes.
- 02Provides Python and JavaScript/TypeScript SDKs.
- 03Keeps variable state across multiple code executions in one sandbox.
- 04Returns execution text and output from each run.
- 05Supports building custom sandbox templates with extra packages or runtimes.
Use cases
- Letting an LLM agent run Python to analyze data and return results.
- Executing untrusted model-generated code without touching the host system.
- Building chat apps that compute answers by running code, such as with OpenAI or Anthropic models.
Quick start
- 1
Install the Python SDK
pip install e2b-code-interpreter - 2
Get an E2B API key from the dashboard and set it as the E2B_API_KEY environment variable
- 3
Run the Python example that creates a Sandbox and executes code in it
Things to know
- Requires an E2B account and API key to create sandboxes.
- Sandboxes run in E2B's cloud, so it depends on a network connection and the hosted service.
Topics
FAQ
- What is code-interpreter?
- Python and JS/TS SDKs for running AI-generated code in isolated cloud sandboxes and reading back its output. E2B Code Interpreter is an SDK that lets AI applications execute code they generate inside secure, isolated cloud sandboxes. Developers create a sandbox from Python or JavaScript/TypeScript, run code in it, and read back the results and printed output.
- Is code-interpreter free to use? What license does it have?
- code-interpreter is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is code-interpreter still maintained?
- Actively maintained. The last commit to code-interpreter was on Oct 20, 2026.
- What can I use code-interpreter for?
- Letting an LLM agent run Python to analyze data and return results. Executing untrusted model-generated code without touching the host system. Building chat apps that compute answers by running code, such as with OpenAI or Anthropic models.
- How do I install code-interpreter?
- Install the Python SDK: pip install e2b-code-interpreter Get an E2B API key from the dashboard and set it as the E2B_API_KEY environment variable Run the Python example that creates a Sandbox and executes code in it
- Where can I get code-interpreter?
- The source code and installation instructions are on GitHub: https://github.com/e2b-dev/code-interpreter
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An all-in-one Docker sandbox giving AI agents a shared browser, shell, file system, VSCode Server, Jupyter and MCP services.
A secure Python sandbox written in Rust for running code generated by AI, without containers.
A learning repository of 30 runnable Jupyter notebooks covering agent memory techniques for LLM agents, from conversation buffers to Mem0, Letta, Zep and Graphiti.
Embeddable, portable microVMs in Rust for running AI agents and untrusted code locally with hardware isolation.
Self-hosted Kubernetes-based infrastructure that runs untrusted code in lightweight VM sandboxes, controlled via a CLI, HTTP API and Python SDK.