Skip to main content
The code interpreter is the stateful execution layer for Python and other notebook-style kernels. Use template="code-interpreter" for the standard Python environment.

Quick start

Contexts

Stream callbacks

Use machine.code_interpreter.run_code() directly when you need the full callback surface:
list_runs is available for read-only hosted beta inspection. Queued async run mutation/wait helpers (create_run, get_run, cancel_run, and wait_for_run) are not part of the hosted private beta launch surface because remote host-agent routing for queued code runs is not implemented yet. Artifact helpers (list_artifacts, get_artifact, download_artifact, preview_artifact, and delete_artifact) are supported for hosted beta run_code executions. Concept: Exec. API reference: executeCode, createCodeContext, createCodeRun, and listCodeArtifacts.