Skip to main content
You are reading a legacy (pre v1.0) document.
E2B’s Code Interpreter SDK allows you to add code interpreting capabilities to your AI apps. The code interpreter runs inside the E2B Sandbox - an open-source secure sandbox made for running untrusted AI-generated code and AI agents.
  • ✅ Works with any LLM and AI framework
  • ✅ Supports streaming content like charts and stdout, stderr
  • ✅ Python & JS SDK
  • ✅ Runs on serverless and edge functions
  • ✅ Runs AI-generated code in secure sandboxed environments
  • ✅ 100% open source (including infrastructure)

Quickstart

1. Install SDK

npm i @e2b/code-interpreter

2. Execute code with code interpreter inside sandbox

import { CodeInterpreter } from '@e2b/code-interpreter'

const sandbox = await CodeInterpreter.create()
await sandbox.notebook.execCell('x = 1')

const execution = await sandbox.notebook.execCell('x+=1; x')
console.log(execution.text)  // outputs 2

await sandbox.close()

3. Hello World guide

Dive depeer and check out the JavaScript and Python the Hello World guides to learn how o connect code interpreter LLMs.
I