Reference
Execute code
Run code in the sandbox. Streams NDJSON events as they happen.
POST
Documentation Index
Fetch the complete documentation index at: https://docs.podflare.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sandbox id from
POST /v1/sandboxes.Source code to execute.
python or bash. Python uses the sandbox’s persistent REPL
(state carries across calls); bash runs in a fresh subprocess.Semantics
- REPL state persists across Python
execcalls. Variables, imports, and open file handles stay alive. - Bash does not persist. Each bash
execis a fresh subprocess. - Serialized per sandbox. Only one
execruns at a time. Concurrent requests queue; if you want parallelism,fork(). - Exceptions don’t poison the REPL. An uncaught Python exception
produces
exit.data != 0but the next call still works.
Timing
| Call | 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 |

