Home/Tools/@tpmjs/tools-unsandbox

executeCodeAsync

@tpmjs/tools-unsandbox

Execute code asynchronously in a secure sandbox. Returns a job_id immediately. Use getJob to check status and retrieve results. Supports 42+ languages.

Official
sandbox
v0.1.4
MIT
⚠️

This tool is currently broken

Execution Failed
Runtime error with test parameters
Unsupported language: "test". Supported languages: python, javascript, typescript, ruby, perl, php, lua, bash, r, elixir, erlang, tcl, scheme, powershell, clojure, commonlisp, crystal, groovy, deno, awk, raku, c, cpp, go, rust, java, kotlin, cobol, fortran, d, zig, nim, v, objc, dart, julia, haskell, ocaml, fsharp, csharp, prolog, forth

Last checked: 3/1/2026, 4:25:52 AM

Interactive Playground

Test @tpmjs/tools-unsandbox (executeCodeAsync) 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-unsandbox
pnpm add @tpmjs/tools-unsandbox
yarn add @tpmjs/tools-unsandbox
bun add @tpmjs/tools-unsandbox
deno add npm:@tpmjs/tools-unsandbox

2. Import the tool

import { executeCodeAsync } from '@tpmjs/tools-unsandbox';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { executeCodeAsync } from '@tpmjs/tools-unsandbox';

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

console.log(result.text);

Signature

(code: string, language: string, env?: Record<string, unknown>, ttl?: number, vcpu?: number, input_files?: { content: string; filename: string }[], network_mode?: string, return_artifact?: boolean, return_wasm_artifact?: boolean) => Promise<unknown>

Tags

ai
async
asynchronously
check
code
code-execution
execute
getjob
immediately
job_id
sandbox
secure
status
tpmjs
unsandbox

Parameters

Available configuration options

Auto-extracted
language
Required
Type: string

Programming language to execute. Supported: python, javascript, typescript, ruby, perl, php, lua, bash, r, elixir, erlang, tcl, scheme, powershell, clojure, commonlisp, crystal, groovy, deno, awk, raku, c, cpp, go, rust, java, kotlin, cobol, fortran, d, zig, nim, v, objc, dart, julia, haskell, ocaml, fsharp, csharp, prolog, forth.

code
Required
Type: string

The source code to execute.

input_files
Optional
Type: array

Optional array of input files to make available in /tmp/input/.

env
Optional
Type: object

Environment variables as key-value pairs.

network_mode
Optional
Type: string

Network isolation mode. "zerotrust" (default) blocks all network. "semitrusted" allows outbound.

ttl
Optional
Type: number

Execution timeout in seconds (1-900). Default: 60.

vcpu
Optional
Type: number

Number of vCPUs (1-8). Each vCPU includes 2GB RAM. Default: 1.

return_artifact
Optional
Type: boolean

For compiled languages, return the compiled binary.

return_wasm_artifact
Optional
Type: boolean

Compile to WebAssembly. Supported for C, C++, Rust, Zig, Go.

Schema extracted: 3/1/2026, 4:25:52 AM

README

ERROR: No README data found!

Statistics

Downloads/month

560

GitHub Stars

0

Quality Score

82%

Bundle Size

NPM Keywords

tpmjs
code-execution
sandbox
unsandbox
ai

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai
executeCodeAsync | TPMJS | TPMJS