Claude AI + E2B Sandbox — Streaming Agent Service
Submit a prompt to the agent. Returns a Server-Sent Events (SSE) stream.
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The user prompt to send to the agent |
session_id | string | null | No | Resume a previous session |
sandbox_id | string | null | No | Reuse a paused sandbox |
files | FileInfo[] | No | Files to download into sandbox: [{"id": "...", "url": "..."}] |
sandbox_mode | "persistent" | "ephemeral" | No | Default "persistent" (pause after completion). "ephemeral" kills sandbox after completion. |
initial_skills | InitialSkill[] | No | Skills to download from blob storage into new sandboxes: [{"skill_id": "dcf", "url": "skills/dcf-.../v2/"}] |
callback_url | string | null | No | URL to POST completion results to |
user_id | string | No | User ID for app storage (default "user-test-001") |
app_id | string | null | No | App ID for versioning. If null, auto-generated on first app creation |
curl -N -X POST /agent \
-H "Content-Type: application/json" \
-d '{"prompt": "Screen for S&P500 companies with positive estimate revisions"}'
| Event | When | Key Fields |
|---|---|---|
sandbox:init_start | Sandbox creation begins | sandbox_id |
sandbox:init_complete | Sandbox ready | sandbox_id, is_existing, workspace_files |
files:download_start | File download begins | file_urls, count |
files:download_progress | Each file completes | file.filename, file.status |
files:download_complete | All files downloaded | — |
agent:start | Agent begins processing | prompt |
agent:message | Each Claude stream-json chunk | type (system / assistant / user / result) |
agent:complete | Agent finished | output, session_id, sandbox_id |
app:artifact | App files changed & uploaded | app_id, version_id, result_urls, source_urls, name, description |
error | Any stage fails | error |
List files in a sandbox directory.
GET /files/list?sandbox_id=xxx&path=/home/user/workspace
Download a file from sandbox.
GET /files?sandbox_id=xxx&path=/home/user/workspace/result.csv
{"status": "healthy"}