Code Interpreter runs AI-generated code inside secure, isolated cloud sandboxes, so an agent can execute what a model writes without giving it your machine. You create and control a sandbox from a JavaScript or TypeScript SDK or a Python SDK, send code to it, and read back the execution result, with state carried between calls in the same sandbox.
Getting started takes three steps: install @e2b/code-interpreter or e2b-code-interpreter, set an E2BAPIKEY environment variable, then create a sandbox and call runCode or run_code. A repeated call against the same sandbox sees variables set by earlier calls, which is what makes multi-step analysis and iterative code generation work.
This repository holds the sandbox template and the chart-data extractor; the two SDK sources have moved into the E2B monorepo, where issues and pull requests for them are filed. If you need extra packages or a different runtime, the template guide walks through creating, building, and using a custom sandbox template, including the production code-interpreter-v1 template.
Features
- Isolated execution: AI-generated code runs in a cloud sandbox rather than on the host that calls it
- Two SDKs: JavaScript/TypeScript and Python clients start sandboxes and run code against them
- Stateful sandboxes: variables set by one runCode call remain available to the next in the same sandbox
- Chart data extraction: the repository ships an extractor for chart output produced inside the sandbox
- Custom templates: sandbox templates can be rebuilt with extra packages or a different runtime
- Cookbook examples: worked examples pair the sandbox with different models and agent frameworks
