Banata

Sandboxes

Sandboxes

Isolated code execution environments with shell access, file operations, multiple runtimes, and optional browser pairing.

A sandbox is an isolated Linux environment running on a dedicated machine. You get a full shell, file system access, and the ability to run code in multiple runtimes. Sandboxes are designed for tasks that go beyond browser automation — code generation, data processing, build pipelines, and multi-step AI agent workflows.


Creating a Sandbox

bash
curl -X POST "https://api.boxes.banata.dev/v1/sandboxes" \
  -H "Authorization: Bearer br_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "runtime": "bun"
  }'

Response:

json
{
  "id": "k82g51hl3on646lel50o9f162t92xu7z",
  "status": "queued",
  "runtime": "bun",
  "size": "standard",
  "capabilities": null
}

Poll GET /v1/sandboxes?id=... until the status becomes ready.

An empty body {} creates a sandbox with defaults: bun runtime, the standard sandbox compute shape, and ephemeral storage.


Runtimes

RuntimeWhat's IncludedBest For
bun (default)Bun JavaScript/TypeScript runtime, npm package supportWeb scraping scripts, API integrations, TypeScript projects
pythonPython 3, pip package supportData processing, ML scripts, analysis tasks
baseMinimal Linux container with common CLI toolsShell scripts, custom toolchains, general-purpose tasks

You can install additional packages within a running sandbox using the runtime's package manager (bun add, pip install, apt-get).


Compute Shape

All sandboxes currently run on the same standard machine shape for stability:

CPUMemoryNotes
2 shared vCPUs4 GBThe current standard sandbox worker shape used for all plans

The public API and SDK expose a single sandbox size value: standard.


Session Options

env

Type: Record<string, string> (optional)

Environment variables to set in the sandbox:

json
{
  "runtime": "bun",
  "env": {
    "API_KEY": "sk_test_...",
    "NODE_ENV": "production"
  }
}

ephemeral

Type: boolean Default: true

Whether the sandbox workspace is ephemeral. When true, the workspace is destroyed when the session ends. Set to false to enable checkpointing.

maxDurationMs

Type: number (optional) Default: Your plan's maximum sandbox duration

Maximum session duration in milliseconds. Must be positive and cannot exceed your plan's limit:

PlanMaximum Duration
Free300,000 ms (5 minutes)
Builder1,800,000 ms (30 minutes)
Pro3,600,000 ms (60 minutes)
Scale7,200,000 ms (2 hours)

region

Type: string (optional)

A 3-letter region code (e.g., iad, lhr) for preferred machine placement. Must match /^[a-z]{3}$/.

capabilities

Type: object (optional)

Enable advanced features. See Sandbox Capabilities for full details.

json
{
  "runtime": "bun",
  "capabilities": {
    "opencode": { "enabled": true, "defaultAgent": "build", "allowPromptApi": true },
    "browser": { "mode": "paired-banata-browser", "recording": true, "streamPreview": true },
    "documents": { "libreofficeHeadless": true },
    "storage": { "workspace": "checkpointed", "artifactPrefix": "my-project/" }
  }
}

Reading Sandbox Status

Single sandbox

bash
curl "https://api.boxes.banata.dev/v1/sandboxes?id=SANDBOX_ID" \
  -H "Authorization: Bearer br_live_..."

Response:

json
{
  "id": "k82g51hl3on646lel50o9f162t92xu7z",
  "status": "ready",
  "runtime": "bun",
  "size": "standard",
  "region": "iad",
  "terminalUrl": "wss://...",
  "previewBaseUrl": null,
  "capabilities": null,
  "pairedBrowser": null,
  "opencode": null,
  "browserPreview": null,
  "humanHandoff": null,
  "artifacts": null,
  "duration": null,
  "createdAt": 1772078705353
}

List all sandboxes

Omit the id to list all sandbox sessions for your organization:

bash
curl "https://api.boxes.banata.dev/v1/sandboxes" \
  -H "Authorization: Bearer br_live_..."

Response:

json
{
  "items": [
    {
      "id": "k82g51hl3on646lel50o9f162t92xu7z",
      "status": "ready",
      "runtime": "bun",
      "size": "standard",
      "region": "iad",
      "createdAt": 1772078705353,
      "startedAt": 1772078708000
    }
  ]
}

Sandbox States

StateDescription
queuedWaiting for machine assignment
assigningMachine selected, environment being prepared
readyEnvironment running, accepting commands
activeActively executing
endingCleanup in progress
endedSession complete
failedError during lifecycle
pausingPause operation in progress
pausedSuspended, can be resumed

Pause and Resume

Sandboxes support pausing to save costs during idle periods. A paused sandbox preserves workspace state and can be resumed later.

Pause

bash
curl -X POST "https://api.boxes.banata.dev/v1/sandboxes/pause" \
  -H "Authorization: Bearer br_live_..." \
  -H "Content-Type: application/json" \
  -d '{"id": "SANDBOX_ID"}'

Resume

bash
curl -X POST "https://api.boxes.banata.dev/v1/sandboxes/resume" \
  -H "Authorization: Bearer br_live_..." \
  -H "Content-Type: application/json" \
  -d '{"id": "SANDBOX_ID"}'

After resuming, the sandbox re-enters the queued → assigning → ready flow. Your workspace files and state are preserved.


Ending a Sandbox

bash
curl -X DELETE "https://api.boxes.banata.dev/v1/sandboxes?id=SANDBOX_ID" \
  -H "Authorization: Bearer br_live_..."

Response: { "ok": true }

This stops the machine and cleans up resources. If you need to preserve workspace contents, create a checkpoint or download artifacts before ending the session.


Concurrent Sandbox Limits

PlanConcurrent Sandboxes
Free1
Builder3
Pro10
Scale50

Monthly Sandbox Hours

PlanSandbox Hours/Month
Free5
Builder50
Pro500
Scale5,000

Error Responses

StatusBodyCause
400Invalid runtime. Must be one of: bun, python, baseInvalid runtime value
400Invalid size: '...'. Must be one of: standardInvalid sandbox size
400Invalid maxDurationMsDuration not positive or exceeds plan limit
401Invalid or missing API keyMissing or invalid API key
403Paired browser is not available on your current plan...Requires Pro plan
429Concurrent sandbox limit reachedAt plan's concurrent limit
429Monthly sandbox hours limit reachedMonthly quota exhausted

Next Steps