Create workspace-scoped sandboxes from an image or snapshot with explicit CPU, memory, GPU, secret, volume, and TTL settings. The current sandbox API is centered on POST /sandboxes.

Core Request Shape

At minimum, a sandbox needs:
  • name
  • workspaceId
  • either image or snapshotId
The API also accepts resource and runtime controls directly on the request:
  • cpuMillis
  • memoryMb
  • gpuCount
  • gpuType
  • maxLifetimeSeconds
  • onTtlExpire
  • secretRefs
  • volumeMounts
  • env
  • args
curl -X POST https://api.agentenv.io/v1/sandboxes \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "python-worker",
    "workspaceId": "YOUR_WORKSPACE_ID",
    "image": "docker://python:3.11-slim",
    "cpuMillis": 1000,
    "memoryMb": 512,
    "maxLifetimeSeconds": 900,
    "env": {
      "PYTHONUNBUFFERED": "1"
    }
  }'

Common Creation Patterns

  • Fresh container boot from image
  • Fast restore from snapshotId
  • Secret injection through secretRefs
  • Shared storage through volumeMounts
  • Automatic cleanup or snapshotting through onTtlExpire
  • GET /sandboxes
  • GET /sandboxes/{id}
  • POST /sandboxes/{id}/start
  • POST /sandboxes/{id}/stop
  • POST /sandboxes/{id}/snapshots

API Pages