@tpmjs/unsandbox
Cancel a running or pending async job. Returns partial stdout/stderr output that was collected before cancellation.
This tool was automatically discovered from the package exports. The author did not explicitly register it in their package.json. Schema and description were auto-extracted.
Test @tpmjs/unsandbox (cancelJob) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/unsandboxpnpm add @tpmjs/unsandboxyarn add @tpmjs/unsandboxbun add @tpmjs/unsandboxdeno add npm:@tpmjs/unsandboximport { cancelJob } from '@tpmjs/unsandbox';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { cancelJob } from '@tpmjs/unsandbox';
const result = await generateText({
model: openai('gpt-4o'),
tools: { cancelJob },
prompt: 'Your prompt here...',
});
console.log(result.text);(job_id: string) => Promise<unknown>Available configuration options
job_idstringThe job ID to cancel.
Schema extracted: 3/1/2026, 4:26:54 AM
AI SDK tools for secure code execution in 42+ programming languages via unsandbox.com.
npm install @tpmjs/unsandbox # or pnpm add @tpmjs/unsandbox
Get an API key at unsandbox.com/api-keys and set it as an environment variable:
export UNSANDBOX_API_KEY=your-api-key
import { streamText } from 'ai'; import { anthropic } from '@ai-sdk/anthropic'; import { executeCode, listLanguages } from '@tpmjs/unsandbox'; const result = streamText({ model: anthropic('claude-sonnet-4-20250514'), tools: { executeCode, listLanguages, }, system: 'You can execute code in 42+ programming languages using a secure sandbox.', prompt: 'Write and run a Python script that calculates the first 10 Fibonacci numbers', });
Execute code synchronously in a secure sandbox.
import { executeCode } from '@tpmjs/unsandbox'; const result = await executeCode.execute({ language: 'python', code: 'print("Hello, World!")', }); // { stdout: "Hello, World!\n", stderr: "", exit_code: 0 }
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
language | string | Yes | Programming language (python, javascript, go, rust, etc.) |
code | string | Yes | Source code to execute |
input_files | array | No | Files to make available in /tmp/input/ |
network_mode | string | No | 'zerotrust' (default) or 'semitrusted' |
ttl | number | No | Timeout in seconds (1-900, default 60) |
return_artifact | boolean | No | Return compiled binary for compiled languages |
return_wasm_artifact | boolean | No | Compile to WebAssembly (C, C++, Rust, Zig, Go) |
Execute code asynchronously, returning a job_id for tracking.
import { executeCodeAsync, getJob } from '@tpmjs/unsandbox'; const job = await executeCodeAsync.execute({ language: 'rust', code: 'fn main() { println!("Hello from Rust!"); }', }); // Check status later const result = await getJob.execute({ job_id: job.job_id });
Execute code with automatic language detection from shebang.
import { runCode } from '@tpmjs/unsandbox'; const result = await runCode.execute({ code: `#!/usr/bin/env python3 print("Auto-detected Python!")`, });
Async version of runCode.
List all active jobs for your API key.
import { listJobs } from '@tpmjs/unsandbox'; const jobs = await listJobs.execute({});
Get status and results of a specific async job.
import { getJob } from '@tpmjs/unsandbox'; const result = await getJob.execute({ job_id: 'abc123' }); // { status: 'completed', stdout: '...', stderr: '...' }
Cancel a running or pending async job.
import { cancelJob } from '@tpmjs/unsandbox'; await cancelJob.execute({ job_id: 'abc123' });
List all 42+ supported programming languages.
import { listLanguages } from '@tpmjs/unsandbox'; const languages = await listLanguages.execute({});
42+ languages including:
| Variable | Required | Description |
|---|---|---|
UNSANDBOX_API_KEY | Yes | API key from unsandbox.com |
MIT
Downloads/month
15
GitHub Stars
0
Quality Score