Home/Tools/@tpmjs/tools-e2b

runCode

@tpmjs/tools-e2b

Execute code in an E2B sandbox. Supports Python, JavaScript, TypeScript, R, Java, and Bash.

Official
sandbox
v0.1.0
MIT
⚠️

This tool is currently broken

Execution Failed
Runtime error with test parameters
Failed to execute code in sandbox test: Failed to connect to sandbox test: 401: authorization header is missing

Last checked: 3/6/2026, 4:14:34 AM

Interactive Playground

Test @tpmjs/tools-e2b (runCode) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-e2b
pnpm add @tpmjs/tools-e2b
yarn add @tpmjs/tools-e2b
bun add @tpmjs/tools-e2b
deno add npm:@tpmjs/tools-e2b

2. Import the tool

import { runCode } from '@tpmjs/tools-e2b';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { runCode } from '@tpmjs/tools-e2b';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { runCode },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Signature

(code: string, sandboxId: string, language?: string, timeoutMs?: number) => Promise<unknown>

Tags

ai
bash
cloud
code
code-execution
code-interpreter
e2b
execute
java
javascript
python
run
sandbox
supports
tpmjs
typescript

Parameters

Available configuration options

Auto-extracted
sandboxId
Required
Type: string

ID of the sandbox to execute in

code
Required
Type: string

Code to execute

language
Optional
Type: string

Language: python (default), javascript, typescript, r, java, bash

timeoutMs
Optional
Type: number

Execution timeout in milliseconds (default: 60000)

Schema extracted: 3/6/2026, 4:14:34 AM

README

ERROR: No README data found!

Statistics

Downloads/month

3

GitHub Stars

19

Quality Score

78%

Bundle Size

NPM Keywords

tpmjs
e2b
sandbox
code-interpreter
ai
code-execution
cloud

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai
runCode | TPMJS | TPMJS