e2b-sandbox
E2B Sandboxes with ComputeSDK
Run code in E2B's Firecracker microVMs through ComputeSDK's unified API. E2B provides sub-second cold starts and secure isolation — ideal for AI code execution, data science, and educational platforms.
Setup
npm install computesdk
# .env
COMPUTESDK_API_KEY=your_computesdk_api_key
E2B_API_KEY=your_e2b_api_key
Get your ComputeSDK key at https://console.computesdk.com/register
Quick Start
import { compute } from 'computesdk';
// Auto-detects E2B from environment variables
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCode('print("Hello from E2B!")');
console.log(result.output);
await sandbox.destroy();
Explicit Configuration
For multi-provider setups or when you want to be explicit:
import { compute } from 'computesdk';
compute.setConfig({
computesdkApiKey: process.env.COMPUTESDK_API_KEY,
provider: 'e2b',
e2b: {
apiKey: process.env.E2B_API_KEY,
}
});
const sandbox = await compute.sandbox.create();
E2B Configuration Options
interface E2BConfig {
apiKey?: string; // Uses E2B_API_KEY env var if not set
runtime?: 'node' | 'python'; // Auto-detects from code patterns
timeout?: number; // Execution timeout in ms
}
Runtime Detection
E2B auto-detects Python from print statements, import, def, and Python-specific syntax like f"strings". All other code defaults to Node.js.
Full API
ComputeSDK provides the same API across all providers: filesystem operations, shell commands, managed servers, overlays, terminals, and client access.
Install the main skill for the complete reference:
npx skills add https://github.com/computesdk/sandbox-skills --skill computesdk
More from computesdk/sandbox-skills
computesdk
Guide for building sandbox applications with ComputeSDK, a unified TypeScript SDK for running untrusted code in sandboxed environments across multiple compute providers (E2B, Daytona, Vercel, Modal, Railway, Namespace, Render). Use this skill when implementing sandboxed code execution, creating isolated development environments, running LLM-generated code safely, building app builders, or integrating dynamic code execution into applications.
11daytona-sandbox
Guide for creating and managing Daytona sandboxes using ComputeSDK. Use when building applications that need Daytona development workspace environments for code execution, full-featured dev environments, or isolated coding workspaces.
10vercel-sandbox
Guide for creating and managing Vercel sandboxes using ComputeSDK. Use when building applications that need Vercel's globally distributed serverless sandbox environments for code execution with Node.js or Python runtimes.
6railway-sandbox
Guide for creating and managing Railway sandboxes using ComputeSDK. Use when building applications that need self-hosted sandbox environments on Railway's infrastructure for code execution, containerized development, or persistent services.
5render-sandbox
Guide for creating and managing Render sandboxes using ComputeSDK. Use when building applications that need self-hosted sandbox environments on Render's cloud platform for code execution with zero infrastructure setup.
4modal-sandbox
Guide for creating and managing Modal sandboxes using ComputeSDK. Use when building applications that need Modal's GPU-accelerated sandbox environments for machine learning workloads, AI inference, or compute-intensive code execution.
4