Run code in a kernel
rent_run_codeRuns code on the Jupyter kernel of a code-interpreter-v1 sandbox and answers its rich results (text, images as base64, …), stdout, stderr and error. State persists between calls in one context_id; a context lives as long as the sandbox. timeout_s defaults to 50. Arguments not listed here go to the REST route as they are, which refuses them by name.
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": {
"sandbox_id": "<sandbox_id>",
"code": "<code>"
},
"name": "rent_run_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | ||
| code | Yes | ||
| language | No | Default python. | |
| timeout_s | No | ||
| context_id | No | ||
| sandbox_id | Yes | Sandbox id (`lse_…`) from rent_create_sandbox or rent_list_sandboxes. It names the sandbox for its whole life and keeps answering rent_get_sandbox, with the final state, after it ends. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | Yes | ||
| stderr | Yes | ||
| stdout | Yes | ||
| results | Yes | ||
| execution_count | Yes |