Agent skill

E2b Code Interpreter

by agent-sandbox in agent-sandbox/agent-sandbox

Execute code in E2B sandboxes and integrate with LLMs for tool calling.

Apache-2.0Auto-check passedAI & LLM Engineering

Install E2b Code Interpreter

skills CLI
$ npx skills add agent-sandbox/agent-sandbox --skill e2b-code-interpreter -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install agent-sandbox/agent-sandbox e2b-code-interpreter --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/agent-sandbox/agent-sandbox.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/e2b-code-interpreter .claude/skills/e2b-code-interpreter && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
e2b-code-interpreter
GitHub stars
218
Token cost
~2.3k tokens
SKILL.md length
170 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
Apache-2.0

At a glance

Execute code in E2B sandboxes and integrate with LLMs for tool calling.

  • Works in 4 steps: Define a tool/function that executes… → Send the tool definition to the LLM → When the LLM calls the tool, execute the… → …
  • Building AI agents that need to run Python/JS code
  • SKILL.md covers Setup, Running Code, Execution Contexts (Shared… and Charts & Visualizations, plus 3 more sections
  • Calls npm and pip

What it does

E2b Code Interpreter is an agent skill from agent-sandbox/agent-sandbox. Execute code in E2B sandboxes and integrate with LLMs for tool calling. Use when building AI agents that need to run Python/JS code, analyze data, generate charts, or use LLM function calling with E2B.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Structured output and tool calling, Data analysis and Building AI agents. It works with Python. The repository describes itself as: Agent-Sandbox is an easy-to-use, enterprise-grade sandbox platform for AI Agents — letting them securely run untrusted LLM-generated code, Browser use, Computer use, and deploy… The licence is Apache-2.0.

When your agent uses it

  • Building AI agents that need to run Python/JS code
  • Generate charts
  • Use LLM function calling with E2B

Example prompts

  • “/e2b-code-interpreter”

Requirements

  • Python 3
  • Node.js

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Define a tool/function that executes code in an E2B sandbox
  2. Send the tool definition to the LLM
  3. When the LLM calls the tool, execute the code in the sandbox
  4. Return execution results to the LLM for interpretation

What it can do on your machine

Read from SKILL.md and the folder at commit 6f7b273. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npm and pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

E2b Code Interpreter loads about 2.3k tokens when it runs. Until then it costs about 56 tokens; SKILL.md has 170 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from agent-sandbox/agent-sandbox at commit 6f7b273, republished under its Apache-2.0 licence (© agent-sandbox). 170 words, ~2,277 tokens.

Download SKILL.mdSave it as .claude/skills/e2b-code-interpreter/SKILL.md (or your agent's skills folder).
name
e2b-code-interpreter
description
Execute code in E2B sandboxes and integrate with LLMs for tool calling. Use when building AI agents that need to run Python/JS code, analyze data, generate charts, or use LLM function calling with E2B.

E2B Code Interpreter — Code Execution & LLM Integration

Setup

bash
# JavaScript/TypeScript
npm install @e2b/code-interpreter

# Python
pip install e2b-code-interpreter
typescript
import { Sandbox } from '@e2b/code-interpreter'

const sandbox = await Sandbox.create()
python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox.create()

Running Code

typescript
const execution = await sandbox.runCode('print("Hello, World!")')

console.log(execution.text)         // "Hello, World!"
console.log(execution.logs.stdout)  // ["Hello, World!\n"]
console.log(execution.logs.stderr)  // []
console.log(execution.error)        // null (or { name, value, traceback })
python
execution = sandbox.run_code('print("Hello, World!")')

print(execution.text)          # "Hello, World!"
print(execution.logs.stdout)   # ["Hello, World!\n"]
print(execution.logs.stderr)   # []
print(execution.error)         # None (or object with name, value, traceback)
Execution Result Structure
FieldTypeDescription
execution.textstringLast text output
execution.resultsarrayRich outputs (.png, .html, .svg, .json, .text)
execution.logs.stdoutstring[]Stdout lines
execution.logs.stderrstring[]Stderr lines
execution.errorobject | nullError with .name, .value, .traceback
Streaming Output
typescript
const execution = await sandbox.runCode('for i in range(5): print(i)', {
  onStdout: (line) => console.log('stdout:', line),
  onStderr: (line) => console.error('stderr:', line),
})
python
execution = sandbox.run_code(
    "for i in range(5): print(i)",
    on_stdout=lambda line: print("stdout:", line),
    on_stderr=lambda line: print("stderr:", line),
)
Language Support

Default is Python. Specify other languages with the language option:

typescript
// Python (default)
await sandbox.runCode('print("Python")')

// JavaScript
await sandbox.runCode('console.log("JavaScript")', { language: 'javascript' })

// R
await sandbox.runCode('cat("R language")', { language: 'r' })

// Java
await sandbox.runCode('System.out.println("Java")', { language: 'java' })

// Bash
await sandbox.runCode('echo "Bash"', { language: 'bash' })
python
sandbox.run_code('print("Python")')
sandbox.run_code('console.log("JavaScript")', language="javascript")
sandbox.run_code('cat("R language")', language="r")

Execution Contexts (Shared State)

By default each runCode call is independent. Use contexts to share state across calls:

typescript
const context = await sandbox.createCodeContext()

await sandbox.runCode('x = 42', { context })
const execution = await sandbox.runCode('print(x)', { context })
console.log(execution.text) // "42"
python
context = sandbox.create_code_context()

sandbox.run_code("x = 42", context=context)
execution = sandbox.run_code("print(x)", context=context)
print(execution.text)  # "42"

Charts & Visualizations

For matplotlib charts, the code must call display() on the figure:

python
# Code to execute in sandbox
code = """
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)
plt.figure(figsize=(10, 6))
plt.plot(x, np.sin(x))
plt.title('Sine Wave')
display(plt.gcf())
"""
typescript
const execution = await sandbox.runCode(code)
// Chart is in execution.results[0].png (base64-encoded)
const chartBase64 = execution.results[0].png
python
execution = sandbox.run_code(code)
chart_base64 = execution.results[0].png

LLM Tool Calling Pattern

The standard pattern for connecting LLMs to E2B:

  1. Define a tool/function that executes code in an E2B sandbox
  2. Send the tool definition to the LLM
  3. When the LLM calls the tool, execute the code in the sandbox
  4. Return execution results to the LLM for interpretation
OpenAI Function Calling
typescript
import OpenAI from 'openai'
import { Sandbox } from '@e2b/code-interpreter'

const openai = new OpenAI()
const sandbox = await Sandbox.create()

const tools = [{
  type: 'function',
  function: {
    name: 'execute_python',
    description: 'Execute Python code in a sandbox',
    parameters: {
      type: 'object',
      properties: {
        code: { type: 'string', description: 'Python code to execute' },
      },
      required: ['code'],
    },
  },
}]

const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Calculate fibonacci of 10' }],
  tools,
})

// Handle tool call
const toolCall = response.choices[0].message.tool_calls?.[0]
if (toolCall) {
  const { code } = JSON.parse(toolCall.function.arguments)
  const execution = await sandbox.runCode(code)
  console.log(execution.text)
}
python
from openai import OpenAI
from e2b_code_interpreter import Sandbox

client = OpenAI()
sandbox = Sandbox.create()

tools = [{
    "type": "function",
    "function": {
        "name": "execute_python",
        "description": "Execute Python code in a sandbox",
        "parameters": {
            "type": "object",
            "properties": {
                "code": {"type": "string", "description": "Python code to execute"},
            },
            "required": ["code"],
        },
    },
}]

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Calculate fibonacci of 10"}],
    tools=tools,
)

tool_call = response.choices[0].message.tool_calls[0]
if tool_call:
    code = json.loads(tool_call.function.arguments)["code"]
    execution = sandbox.run_code(code)
    print(execution.text)
Anthropic Tool Use
typescript
import Anthropic from '@anthropic-ai/sdk'
import { Sandbox } from '@e2b/code-interpreter'

const anthropic = new Anthropic()
const sandbox = await Sandbox.create()

const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-5-20250929',
  max_tokens: 1024,
  tools: [{
    name: 'execute_python',
    description: 'Execute Python code in a sandbox',
    input_schema: {
      type: 'object',
      properties: {
        code: { type: 'string', description: 'Python code to execute' },
      },
      required: ['code'],
    },
  }],
  messages: [{ role: 'user', content: 'Calculate the first 20 primes' }],
})

// Handle tool use
for (const block of response.content) {
  if (block.type === 'tool_use') {
    const execution = await sandbox.runCode(block.input.code)
    console.log(execution.text)
  }
}
python
import anthropic
from e2b_code_interpreter import Sandbox

client = anthropic.Anthropic()
sandbox = Sandbox.create()

response = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1024,
    tools=[{
        "name": "execute_python",
        "description": "Execute Python code in a sandbox",
        "input_schema": {
            "type": "object",
            "properties": {
                "code": {"type": "string", "description": "Python code to execute"},
            },
            "required": ["code"],
        },
    }],
    messages=[{"role": "user", "content": "Calculate the first 20 primes"}],
)

for block in response.content:
    if block.type == "tool_use":
        execution = sandbox.run_code(block.input["code"])
        print(execution.text)

Data Analysis Workflow

Upload data, prompt the LLM to generate analysis code, execute in sandbox, extract results.

typescript
import { Sandbox } from '@e2b/code-interpreter'

const sandbox = await Sandbox.create()

// 1. Upload data
await sandbox.files.write('/home/user/data.csv', csvContent)

// 2. Run analysis code (generated by LLM or hand-written)
const execution = await sandbox.runCode(`
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('/home/user/data.csv')
print(df.describe())

plt.figure(figsize=(10, 6))
df.plot(kind='bar')
plt.tight_layout()
display(plt.gcf())
`)

// 3. Get results
console.log(execution.text)           // Statistical summary
const chart = execution.results[0].png // Base64 chart image
python
from e2b_code_interpreter import Sandbox

sandbox = Sandbox.create()

# 1. Upload data
sandbox.files.write("/home/user/data.csv", csv_content)

# 2. Run analysis
execution = sandbox.run_code("""
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('/home/user/data.csv')
print(df.describe())

plt.figure(figsize=(10, 6))
df.plot(kind='bar')
plt.tight_layout()
display(plt.gcf())
""")

# 3. Get results
print(execution.text)
chart = execution.results[0].png

Python Context Manager

python
from e2b_code_interpreter import Sandbox

# Sandbox is automatically killed when the block exits
with Sandbox.create() as sandbox:
    execution = sandbox.run_code("print('Hello')")
    print(execution.text)

© agent-sandbox, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/e2b-code-interpreter of agent-sandbox/agent-sandbox.

Open the folder on GitHubat commit 6f7b273

Compare with similar skills

E2b Code Interpreter next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

E2b Code Interpreter compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
E2b Code Interpreter this skillagent-sandbox/agent-sandbox218—~2.3kAutomated safety check: PassApache-2.0
Google Agents CLI Adk Codepifferologo/cloud-agents-cli1291 repos~768Automated safety check: PassApache-2.0
Ag2 Overviewag2ai/build-with-ag2252—~1.3kAutomated safety check: NotesApache-2.0
Building Pydantic AI Agentsdocling-project/docling68k—~2.8kAutomated safety check: PassMIT
LangGraph Decision Modelslangchain-ai/langchain-skills1.3k—~2.3kAutomated safety check: PassMIT
Tool Designagentailor/fullstack-langgraph-nextjs-agent132—~3.2kAutomated safety check: PassMIT

Similar skills

  • Google Agents CLI Adk Code

    pifferologo/cloud-agents-cli

    This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management", or needs ADK (Agent…

    129 GitHub starsUsed in 1 repo~768 tokens
    AI & LLM EngineeringAuto-check passed
  • Ag2 Overview

    ag2ai/build-with-ag2

    Map of AG2 beta capabilities and which sibling skill to reach for.

    252 GitHub stars~1.3k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check: notes
  • Building Pydantic AI Agents

    docling-project/docling

    Patterns and tested examples for building agents with Pydantic AI: tools, capabilities, structured output, dependency injection, hooks, YAML specs, streaming and testing.

    68k GitHub stars~2.8k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • LangGraph Decision Models

    langchain-ai/langchain-skills

    Official

    Routes LangGraph agents with typed decision models that return probabilities, and finds LLM calls that only exist to produce a routing decision.

    1.3k GitHub stars~2.3k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Tool Design

    agentailor/fullstack-langgraph-nextjs-agent

    Design and verify tools that AI agents can actually use — for any framework or language (MCP servers, LangChain/LangGraph, function-calling, raw JSON schema; TypeScript, Python, or otherwise).

    132 GitHub stars~3.2k tokensUpdated 1 mo ago
    AI & LLM EngineeringAuto-check passed
  • Langchain Middleware

    langchain-ai/langchain-skills

    Official

    INVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output.

    1.3k GitHub starsUsed in 1 repo~2.7k tokens
    AI & LLM EngineeringAuto-check passed

More from agent-sandbox/agent-sandbox

  • E2b Sandbox

    agent-sandbox/agent-sandbox

    Create, manage, and use E2B sandboxes — run commands, manage files, use git, persist state, and configure networking.

    218 GitHub stars~2.6k tokensUpdated 17 days ago
    Auto-check passed
  • AI Deploy

    agent-sandbox/agent-sandbox

    Deploy a generated project (one process or several) to agent-sandboxes with scale-to-zero: idle sandboxes pause and auto-resume (process restarted) on the next HTTP request.

    218 GitHub stars~3k tokensUpdated 17 days ago
    Auto-check: notes
  • E2b

    agent-sandbox/agent-sandbox

    Core E2B SDK knowledge — correct imports, namespacing, terminology, and API patterns.

    218 GitHub stars~732 tokensUpdated 17 days ago
    Auto-check passed

Works with

Questions about E2b Code Interpreter

What does E2b Code Interpreter do?

Execute code in E2B sandboxes and integrate with LLMs for tool calling. E2b Code Interpreter is an agent skill from agent-sandbox/agent-sandbox. Execute code in E2B sandboxes and integrate with LLMs for tool calling.

When should I use E2b Code Interpreter?

E2b Code Interpreter fits situations like: building AI agents that need to run Python/JS code; generate charts; use LLM function calling with E2B.

How do I install E2b Code Interpreter in Claude Code?

Run `npx skills add agent-sandbox/agent-sandbox --skill e2b-code-interpreter -a claude-code`. Or copy the skill folder (skills/e2b-code-interpreter in agent-sandbox/agent-sandbox) into .claude/skills/e2b-code-interpreter in your project. Claude Code loads it when a task matches its description.

How do I install E2b Code Interpreter in Codex?

Run `npx skills add agent-sandbox/agent-sandbox --skill e2b-code-interpreter -a codex`. Or copy the skill folder (skills/e2b-code-interpreter in agent-sandbox/agent-sandbox) into .agents/skills/e2b-code-interpreter in your project. Codex loads it when a task matches its description.

Can I use E2b Code Interpreter in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agent-sandbox/agent-sandbox --skill e2b-code-interpreter -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/e2b-code-interpreter, .gemini/skills/e2b-code-interpreter, .github/skills/e2b-code-interpreter and .opencode/skills/e2b-code-interpreter in your project.

What does E2b Code Interpreter need to run?

Going by SKILL.md and its folder, E2b Code Interpreter needs the command-line tools its instructions call (npm and pip). Our summary lists: Python 3; Node.js.

Does E2b Code Interpreter access the network?

SKILL.md contains no URLs. Its commands use npm and pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is E2b Code Interpreter safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does E2b Code Interpreter use?

E2b Code Interpreter is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does E2b Code Interpreter use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to E2b Code Interpreter?

Skills that share tags, products or a category with E2b Code Interpreter: Google Agents CLI Adk Code (pifferologo/cloud-agents-cli, 129 stars), Ag2 Overview (ag2ai/build-with-ag2, 252 stars), Building Pydantic AI Agents (docling-project/docling, 68k stars) and LangGraph Decision Models (langchain-ai/langchain-skills, 1.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains E2b Code Interpreter?

agent-sandbox (a GitHub organization) maintains it in agent-sandbox/agent-sandbox, which has 218 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on September 20, 2026.

Source: agent-sandbox/agent-sandbox on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.