Getting started in under a minute.
AgentRunBox gives your AI agents a secure sandbox to execute code, run commands, and manage files.
Installation
https://api.agentrunbox.com (production) or http://localhost:8787 (local dev).
Authentication
All API requests require a Bearer token in the Authorization header. Two types are supported:
API Keys
Prefixed with arb_. Created via the dashboard or API. Best for programmatic access.
JWT Tokens
Issued via POST /auth/login. 7-day expiry. Best for session-based access.
Providers
Choose the right isolation level for your use case.
Fastest. Runs in the same V8 isolate. Sub-1ms start. Works in Workers and browsers.
Full Linux environment. Any Docker image. Best for native toolchains.
Edge-deployed containers. Global distribution, auto-scaling.
Your own infrastructure. Point at any host running the agent binary.
API Reference
Complete REST API. All endpoints accept and return JSON unless noted. Streaming endpoints use Server-Sent Events.
Base URL: https://api.agentrunbox.com
Sandboxes
Sandbox lifecycle — create, list, pause, resume, destroy.
/sandboxes Create a new sandbox
{
"template": "node", // base|node|python|rust|go
"metadata": { "user": "abc" },
"envVars": { "NODE_ENV": "production" },
"timeout": 600, // seconds (30-3600)
"files": { // seed files
"/project/index.js": "console.log('hello')"
}
} {
"id": "sbx_abc123def456",
"status": "running",
"template": "node",
"metadata": { "user": "abc" },
"createdAt": "2026-04-10T12:00:00Z",
"expiresAt": "2026-04-10T12:10:00Z"
} /sandboxes List sandboxes
Query params: status (running|paused|stopped), metadata (key:value filter).
{ "sandboxes": [SandboxInfo, ...] } /sandboxes/:id Get sandbox details
SandboxInfo
/sandboxes/:id Destroy sandbox
Cleans up R2 blocks, D1 metadata, and container.
{ "ok": true, "id": "sbx_..." } /sandboxes/:id/pause Pause sandbox
Sleeps container, keeps filesystem in R2. No compute charges.
{ "ok": true, "status": "paused" } /sandboxes/:id/resume Resume paused sandbox
{ "ok": true, "status": "running" } /sandboxes/:id/keepalive Extend idle timeout
{ "ok": true } Commands
Command and bash script execution with hybrid routing.
/sandboxes/:id/commands Run a command (one-shot)
Built-in commands (grep, find, awk, sed, etc.) run in-worker. Unknown commands auto-escalate to the container.
{
"command": "grep",
"args": ["-rn", "TODO", "/project/src"],
"cwd": "/project",
"timeout": 30000,
"envVars": { "DEBUG": "1" }
} {
"stdout": "src/app.ts:42: // TODO fix\n",
"stderr": "",
"exitCode": 0,
"durationMs": 2.3,
"executedIn": "worker" // worker|sandbox|mixed
} /sandboxes/:id/commands/stream Run command with SSE streaming
Same request body. Returns text/event-stream with events: stdout, stderr, exit, error.
{ "command": "npm", "args": ["test"] } event: stdout
data: {"line": "PASS src/app.test.ts"}
event: exit
data: {"exitCode": 0, "durationMs": 2340, "executedIn": "sandbox"} /sandboxes/:id/bash Execute a bash script
Full bash with pipes, expansion, control flow. Shell state (env, cwd, functions) persists across calls.
{
"script": "cd /project && npm install && npm test",
"cwd": "/project",
"timeout": 60000
} {
"stdout": "...",
"stderr": "...",
"exitCode": 0,
"durationMs": 4200,
"executedIn": "mixed"
} /sandboxes/:id/bash/stream Execute bash script with SSE streaming
Same as /bash but returns text/event-stream.
Files
Filesystem operations — read, write, search, bulk upload/download.
/sandboxes/:id/files?path=/dir List directory contents
{
"path": "/project/src",
"entries": [
{ "name": "app.ts", "type": "file", "size": 1234 },
{ "name": "utils", "type": "directory" }
]
} /sandboxes/:id/files/<path> Read a file
Returns file content as text/plain. Headers: X-File-Path, X-File-Size.
(text/plain) file contents
/sandboxes/:id/files/<path> Write/create a file
Send file content as text/plain or application/octet-stream body.
{ "path": "/project/src/app.ts", "size": 1234 } /sandboxes/:id/files/<path> Delete file or directory
{ "ok": true, "path": "/project/old.txt" } /sandboxes/:id/files/<path> Move/rename a file
{ "destination": "/project/new-name.ts" } { "from": "/project/old.ts", "to": "/project/new-name.ts" } /sandboxes/:id/files/upload Bulk upload files
{
"files": {
"/project/src/a.js": "const x = 1;",
"/project/src/b.js": "const y = 2;"
}
} { "written": 2 } /sandboxes/:id/files/download Download multiple files
{ "paths": ["/project/a.js", "/project/b.js"] } { "files": { "/project/a.js": "...", "/project/b.js": "..." } } /sandboxes/:id/files/search Search file contents (grep-like)
{
"pattern": "TODO|FIXME",
"path": "/project",
"glob": "**/*.ts",
"maxResults": 100
} {
"matches": [
{ "file": "/project/src/app.ts", "line": 42, "content": "// TODO fix" }
]
} /sandboxes/:id/files/find Find files by glob pattern
{ "pattern": "**/*.ts", "path": "/project" } { "files": ["/project/src/app.ts", "/project/src/utils.ts"] } Processes
Long-lived process management. Runs in the container.
/sandboxes/:id/processes Start a long-lived process
Runs in the container sandbox. Returns immediately with a PID.
{
"command": "npm",
"args": ["run", "dev"],
"cwd": "/project",
"envVars": { "PORT": "3000" }
} {
"pid": "proc_xyz789",
"command": "npm",
"args": ["run", "dev"],
"status": "running",
"startedAt": "2026-04-10T12:00:00Z"
} /sandboxes/:id/processes List running processes
{ "processes": [ProcessInfo, ...] } /sandboxes/:id/processes/:pid Get process details
ProcessInfo
/sandboxes/:id/processes/:pid Kill a process
Query param: force=1 for SIGKILL (default SIGTERM).
{ "ok": true, "pid": "proc_xyz789" } /sandboxes/:id/processes/:pid/logs Get process logs
Query param: since (cursor/timestamp).
{ "logs": ["line1", "line2", ...] } /sandboxes/:id/processes/:pid/logs/stream Stream process logs (SSE)
Returns text/event-stream with log lines.
/sandboxes/:id/processes/:pid/input Send stdin to a process
Send text/plain body as stdin input.
{ "ok": true } Git
Git operations via isomorphic-git. Runs in-worker.
/sandboxes/:id/git/clone Clone a repository
Runs in-worker via isomorphic-git. Supports shallow clones.
{
"url": "https://github.com/user/repo.git",
"path": "/project",
"branch": "main",
"depth": 1
} {
"ok": true,
"path": "/project",
"url": "https://github.com/user/repo.git",
"branch": "main"
} /sandboxes/:id/git/status?path=/project Git status
{
"path": "/project",
"files": [
{ "filepath": "src/app.ts", "status": "modified", "staged": false },
{ "filepath": "src/new.ts", "status": "new", "staged": false }
]
} /sandboxes/:id/git/commit Stage and commit changes
{
"path": "/project",
"message": "feat: add new feature",
"files": ["src/app.ts"],
"author": {
"name": "agentrunbox",
"email": "sandbox@agentrunbox.dev"
}
} { "oid": "a1b2c3d...", "message": "feat: add new feature" } /sandboxes/:id/git/log?path=/project&depth=20 Git log
{
"path": "/project",
"commits": [{
"oid": "a1b2c3d...",
"message": "feat: add new feature",
"author": { "name": "agent", "email": "..." },
"timestamp": 1712750400
}]
} /sandboxes/:id/git/diff?path=/project Git diff (changed files)
{
"path": "/project",
"changes": [
{ "filepath": "src/app.ts", "status": "modified" }
]
} Schemas
Core data types returned by the API.
SandboxInfo | Field | Type |
|---|---|
| id | string |
| status | SandboxStatus |
| template | string |
| metadata | object |
| createdAt | string (ISO 8601) |
| expiresAt | string | null |
CommandResponse | Field | Type |
|---|---|
| stdout | string |
| stderr | string |
| exitCode | integer |
| durationMs | number |
| executedIn | string |
FileEntry | Field | Type |
|---|---|
| name | string |
| type | string |
| size | integer |
| modifiedAt | string |
ProcessInfo | Field | Type |
|---|---|
| pid | string |
| command | string |
| args | string[] |
| status | string |
| startedAt | string |
| exitCode | integer |