runtime_exec
Execute Python code in a persistent Jupyter kernel, preserving variables and functions across calls to handle iterative model-driven coding tasks.
Instructions
Execute model-generated Python in a persistent IPython/Jupyter kernel. Variables, imports, and helper functions survive across calls sharing session_id. Use await tools.(...) or await call(name, args) for MCP capabilities, await describe() for the declared catalog, and result(value) to return structured data. The kernel is an unrestricted control environment, not a sandbox, so this tool is available only with --dangerously-open-machine.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python/IPython cell source. Top-level await is supported. Use result(value) for a structured result. | |
| max_calls | No | Maximum MCP capability calls from this cell; defaults to 32. | |
| session_id | No | Persistent kernel namespace. Defaults to default. State survives until reset, idle eviction, worker restart, or timeout termination. | |
| timeout_ms | No | Cell execution limit; defaults to 30000 ms. A timeout terminates the session to guarantee cleanup. | |
| allow_tools | No | Exact MCP capabilities callable from this cell. Defaults to all read-only capabilities. Mutating capabilities must be explicitly declared. | |
| reset_session | No | Terminate any existing kernel for session_id before executing this cell. | |
| max_output_bytes | No | Maximum captured stdout/stderr/display output for this cell; defaults to 1048576. |