Request
Sandbox id returned by
POST /v1/sandboxes.Source code to execute inside the sandbox.
Runtime to use.
python runs code in the sandbox’s persistent REPL — state carries across calls. bash runs code in a fresh subprocess that exits after each call.Response
The response isapplication/x-ndjson. Each line is a JSON event object:
stdout, stderr, or exit.For
stdout / stderr: one line of text. For exit: the integer exit code.Monotonic counter per
exec call. Use this to reorder events that arrive out of sequence.Host wall-clock time in milliseconds since the Unix epoch.
Examples
Execution semantics
Timing reference
| Operation | Approximate wall clock |
|---|---|
run_code("print(6*7)") in a warm pool-hit sandbox | ~3–5 ms |
First import pandas (cold file cache) | ~500 ms |
Subsequent import pandas (warm page cache) | ~150 ms |
Error responses
| Status | Body | Cause |
|---|---|---|
401 | {"error": "invalid api key"} | Missing or invalid bearer token |
404 | {"error": "sandbox not found"} | Sandbox id does not exist |
500 | {"error": "..."} | Agent did not respond or executor error |