ipython
Run Python in a persistent kernel to keep variables, imports, cwd, environment, and async tasks across calls; detach long-running cells and collect output, interrupt, or restart later.
Instructions
Run Python in a persistent kernel. Variables, imports, cwd, os.environ and asyncio tasks persist across calls. Top-level await works; the last expression is shown as Out[N]. Each reply ends with [env: ...] listing your live names. Helpers: bash(cmd, timeout=600) starts a shell command in the background and returns a handle h: h.running, h.tail(n), h.output() (waits for exit), await h, h.wait(), h.kill(). env() lists all names; save(name)/load(name) snapshot variables to disk; reset() deletes them. A cell still running after timeout (default 45s, max 600s) keeps running detached and the call returns. Then: code "" waits and collects its output (and any background output); "%interrupt" stops it; "%restart" kills the kernel (state lost); "%status" shows kernel, running cell and bash jobs. New code is refused while a cell runs. Output is capped at ~30000 chars (head and tail kept): print slices, counts or summaries of large data, not whole objects.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "ipython"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python source, or "" / "%interrupt" / "%restart" / "%status" | |
| timeout | No | Seconds to wait before detaching (default 45) |