Python code execution API
Execute user-submitted Python from your product with one HTTPS request. CodeForge runs it on CPython 3.12 in an isolated sandbox with no network access and returns stdout, stderr and the exit code.
Example: run Python with one request
Submit the source and stdin, then poll GET /v1/executions/{id} until it finishes.
n = int(input())
print(sum(i * i for i in range(n)))
curl -X POST https://api.tatvastack.com/v1/executions \
-H "Authorization: Bearer $CODEFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"language":"python","source":"n = int(input())\nprint(sum(i * i for i in range(n)))","stdin":"10"}'
{
"executionId": "exe_…",
"status": "SUCCEEDED",
"language": "python",
"stdout": "285\n",
"stderr": "",
"exitCode": 0,
"durationMs": …
}
Python execution questions
Which Python version does the API use?
CPython 3.12. Version changes are announced in advance.
Can I use NumPy, pandas or other pip packages?
Not yet. Programs run with the standard library only, which keeps runs fast and the sandbox small. Tell us which packages you need.
How do I pass input to the program?
Send it as the stdin field of the request; the program reads it with input() or sys.stdin, exactly like a terminal.
What happens on an exception?
The execution finishes with status RUNTIME_ERROR, a non-zero exitCode and the traceback in stderr. It is a normal result, not an API error.
Run Python in your product today
500 free runs a month during the beta. No servers to manage.