# Code interpreter

> Run Python in a sandbox. Registered only when the host opts in.

Source: https://kcq.nebutra.com/docs/agent/tools/code-interpreter


<Callout>
  Generated from the pinned chart source (

  [`1aa5e22`](https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/foundation/agent/chartToolRegistry.ts)

  ). Descriptions are the exact text the model receives.
</Callout>

code_interpreter [#code_interpreter]

<ToolMeta label="Run Python" safety="destructive" safetyLabel="Modifies the chart" mode="Runs in order" origin="Opt-in" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/agent-runtime/src/tools/code-interpreter/tool.ts#L11" sourceLabel="Source" />

Execute Python code in an isolated sandbox with numpy and pandas available and outbound network disabled. Read inputs from $INPUT\_DIR and write files you want returned into $OUTPUT\_DIR.

**Parameters**

| Name                           | Type                   | Required | Constraints                                            | Description                                                                              |
| ------------------------------ | ---------------------- | -------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| <code>code</code>              | <code>string</code>    | Yes      | min length <code>1</code>                              | Python source to execute. Only the standard library plus numpy and pandas are available. |
| <code>files</code>             | <code>object\[]</code> | —        | max items <code>16</code>                              |                                                                                          |
| <code>files\[].name</code>     | <code>string</code>    | —        | min length <code>1</code>; max length <code>255</code> |                                                                                          |
| <code>files\[].content</code>  | <code>string</code>    | —        | —                                                      |                                                                                          |
| <code>files\[].encoding</code> | <code>enum</code>      | —        | one of <code>"utf8", "base64"</code>                   |                                                                                          |
| <code>timeoutMs</code>         | <code>integer</code>   | —        | ≥ <code>1</code>; ≤ <code>60000</code>                 |                                                                                          |

**Minimal input** · Required fields only; placeholders are derived from the schema.

```json
{
  "code": "<code>"
}
```

<ToolSchema name="code_interpreter" label="JSON Schema" />
