Runra Sandbox Documentation
Build with Runra Sandbox, an E2B-compatible sandbox API for AI agents.
Developer docs
Build AI agents that safely run code
Runra Sandbox gives production AI agents isolated cloud workspaces for code execution, files, packages, ports, and long-running tasks. It is E2B-compatible, with Runra-native API keys, endpoints, templates, and billing.
import { Sandbox } from "runra";
const sandbox = await Sandbox.create();
const result = await sandbox.runCode(
'print("hello from Runra")'
);
console.log(result.text);
await sandbox.kill();Runra is a sandbox infrastructure layer for agent platforms. Create a VM-backed workspace on demand, run generated code or shell commands, move files in and out, pause state when work is idle, and terminate the environment when the task is complete.
Run code in minutes
Use the Runra SDK to create a sandbox and execute code from your application.
JavaScript and TypeScript
npm install runra
# or
bun add runra
export RUNRA_API_KEY=runra_your_api_key
# Optional. Defaults to https://box.runra.dev
export RUNRA_API_URL=https://box.runra.dev
import { Sandbox } from "runra";
const sandbox = await Sandbox.create({ timeout: 300 });
try {
const execution = await sandbox.runCode(`
name = "Runra"
print(f"hello from {name}")
2 + 2
`);
console.log(execution.logs.stdout.join("\n"));
console.log("Result:", execution.text);
} finally {
await sandbox.kill();
}
Python
pip install runra e2b-code-interpreter
from runra import Sandbox
sandbox = Sandbox.create(timeout=300)
try:
execution = sandbox.run_code('print("hello from Runra")')
print("\n".join(execution.logs.stdout))
finally:
sandbox.kill()
Start building
Pick the path closest to your workload. The cards below keep the existing docs flow, but present it like a product API surface instead of a plain table of contents.
Create a sandbox, execute Python, run shell commands, and clean up safely.
Read more →LLM agentsConnect an LLM to RunraExpose a sandbox-backed run_python tool for generated code and agent workflows.
Read more →FilesUpload and download filesWrite inputs, run transforms, and read generated outputs from the sandbox filesystem.
Read more →PackagesInstall custom packagesAdd Python or Node packages at runtime, or prebuild reusable templates.
Read more →APIUse the REST APICreate and manage sandboxes directly with bearer-token authentication.
Read more →SDK referenceExplore compatible methodsUse runCode(), commands.run(), file APIs, and sandbox lifecycle calls.
Read more →Core API surface
The most common production flow is create, execute, optionally pause, and delete. Use the full API reference for request and response schemas.
/v1/sandboxesCreate a new isolated sandbox.POST/v1/sandboxes/:id/executeRun code or commands inside a sandbox.POST/v1/sandboxes/:id/pausePreserve sandbox state without keeping compute active.DELETE/v1/sandboxes/:idTerminate a sandbox when the task is complete.How to use the docs
- New to Runra: start with the Quickstart and then connect an LLM agent.
- Moving data through sandboxes: read Upload and download files.
- Custom runtime needs: read Install custom packages and Configuration.
- Building against HTTP endpoints: read the API overview and Authentication.
Environment variables
| Variable | Required | Description |
|---|---|---|
RUNRA_API_KEY | Yes | Your Runra API key, for example runra_.... |
RUNRA_API_URL | No | Defaults to https://box.runra.dev. |
RUNRA_TEMPLATE_ID | No | Default sandbox template ID. |