Agents SDK

Sandboxes

A sandbox is a persistent runtime environment with its own filesystem, git state, and sessions. All endpoints require an Authorization: Bearer <api_key> header.

Create Sandbox

POSThttps://relay.an.dev/v1/sandboxes

Creates a new sandbox environment for the specified agent. Optionally seed it with files, environment variables, and setup commands.

Request Body

NameTypeRequiredDescription
agentstringRequiredAgent slug to use for this sandbox
filesobjectOptionalMap of file path → content to seed
envsobjectOptionalEnvironment variables to set
setupstring[]OptionalShell commands to run after creation
Request Body
{
  "agent": "my-agent",
  "files": { "/home/user/workspace/config.json": "{\"key\": \"value\"}" },
  "envs": { "NODE_ENV": "production" },
  "setup": ["npm install -g prettier"]
}

Response

{
  "id": "sb_abc123",
  "sandboxId": "e2b-sandbox-id",
  "status": "active",
  "createdAt": "2026-02-26T12:00:00Z"
}
cURL
curl -X POST https://relay.an.dev/v1/sandboxes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent": "my-agent",
    "files": { "/home/user/workspace/config.json": "{\"key\": \"value\"}" },
    "setup": ["npm install -g prettier"]
  }'

Get Sandbox

GEThttps://relay.an.dev/v1/sandboxes/:id

Retrieves details about an existing sandbox including its agent, threads, and current status.

Path Parameters

NameTypeRequiredDescription
idstringRequiredSandbox ID

Response

{
  "id": "sb_abc123",
  "sandboxId": "e2b-sandbox-id",
  "status": "active",
  "error": null,
  "agent": { "slug": "my-agent", "name": "My Agent" },
  "threads": [
    { "id": "th_xyz789", "name": "Chat 1", "status": "completed" }
  ],
  "createdAt": "2026-02-26T12:00:00Z",
  "updatedAt": "2026-02-26T12:05:00Z"
}
cURL
curl https://relay.an.dev/v1/sandboxes/sb_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Delete Sandbox

DELETEhttps://relay.an.dev/v1/sandboxes/:id

Deletes the sandbox and cascades deletion to all threads within it. Returns 204 No Content on success.

Path Parameters

NameTypeRequiredDescription
idstringRequiredSandbox ID

Returns 204 No Content on success.

cURL
curl -X DELETE https://relay.an.dev/v1/sandboxes/sb_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"