run_python
Run a short Python program in an isolated sandbox and get back exit code, stdout, stderr, duration and up to 3 artifact files from ./out/. Python 3.12 + numpy/pandas/requests, no network, 512 MB, 30 s max, 32 KB code, 4 input files of 256 KB. Free compile-only syntax check first at POST /api/v1/run-python/validate. $0.05/call (one run) via x402. Free syntax check: POST /api/v1/run-python/validate. Free worked example: GET /api/v1/run-python/example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Command-line arguments (sys.argv[1:]), at most 16. | |
| code | Yes | Python 3 program source, at most 32 KB. Runs as main.py in an empty working directory. | |
| files | No | Up to 4 input files written into the working directory before the run. | |
| stdin | No | Text piped to the program on standard input (at most 32 KB). | |
| timeout_s | No | Wall-clock limit for the program in seconds (default 15, max 30). |