Runtimes
Available sandbox runtimes, custom templates, and pre-installed packages for Python, Node.js, and Deno environments.
Available Runtimes
Each sandbox boots with a pre-configured runtime environment. Choose the runtime that matches your agent's needs.
Python 3.12
const sandbox = await tx.sandboxes.create({
runtime: 'python-3.12',
});Pre-installed packages:
pip(latest)setuptools,wheelrequestsjson,csv,re(standard library)
Package manager: pip install <package>
Node.js 20
const sandbox = await tx.sandboxes.create({
runtime: 'node-20',
});Pre-installed tools:
npm(latest)yarn(v1)npx
Package manager: npm install <package>
Deno
const sandbox = await tx.sandboxes.create({
runtime: 'deno',
});Features:
- Secure by default (explicit permission flags)
- Built-in TypeScript support
- URL-based imports, no package manager needed
Run with permissions: deno run --allow-net --allow-read script.ts
Runtime Comparison
| Feature | Python 3.12 | Node.js 20 | Deno |
|---|---|---|---|
| Package manager | pip | npm/yarn | URL imports |
| TypeScript | No (use mypy) | Via tsx/ts-node | Built-in |
| Async model | asyncio | Event loop | Event loop |
| Best for | Data science, scripting | Web APIs, tooling | Secure scripting |
| Startup | ~150ms | ~120ms | ~130ms |
Custom Templates
Create reusable sandbox templates with pre-installed packages and configuration. Templates snapshot a sandbox state so new instances boot with everything already installed.
Create a Template
// 1. Create a base sandbox
const sandbox = await tx.sandboxes.create({
runtime: 'python-3.12',
});
// 2. Install your dependencies
await tx.sandboxes.run(sandbox.id, {
command: 'pip',
args: ['install', 'pandas', 'numpy', 'scikit-learn', 'matplotlib'],
});
// 3. Add configuration files
await tx.sandboxes.writeFile(sandbox.id, {
path: '/home/user/.config/settings.json',
content: JSON.stringify({ theme: 'dark', verbose: true }),
});
// 4. Save as template
const template = await tx.sandboxes.createTemplate(sandbox.id, {
name: 'data-science',
description: 'Python with pandas, numpy, scikit-learn, matplotlib',
});
// 5. Clean up the base sandbox
await tx.sandboxes.destroy(sandbox.id);Use a Template
const sandbox = await tx.sandboxes.create({
template: 'data-science',
});
// pandas, numpy, etc. are already installed
const result = await tx.sandboxes.run(sandbox.id, {
command: 'python3',
args: ['-c', 'import pandas; print(pandas.__version__)'],
});List Templates
const templates = await tx.sandboxes.listTemplates();
for (const t of templates) {
console.log(`${t.name} (${t.runtime}) - ${t.description}`);
}Resource Configuration by Runtime
You can customize resource allocation per sandbox:
const sandbox = await tx.sandboxes.create({
runtime: 'python-3.12',
resources: {
cpu: 2, // vCPUs (1-4)
memory: 1024, // MB (256-4096)
disk: 5120, // MB (1024-10240)
},
timeout: 600, // seconds (max 3600)
network: true, // enable outbound network access
});Next Steps
- Sandboxes Quickstart — Create your first sandbox
- Sandboxes Overview — Full feature reference
- Code Execution — For quick, stateless scripts without a full VM