run_python
Execute Python code in a subprocess, capture stdout/stderr and generated files, and enforce a timeout for bounded, reproducible runs.
Instructions
Execute Python code in a subprocess and return captured output plus produced files.
Resource controls: code is limited to 100,000 characters; stdout and stderr
are each truncated to 20,000 characters. On timeout the whole process tree
is terminated (Windows: ``taskkill /F /T``) and the error result carries the
output captured so far plus ``elapsed_seconds`` and changed ``files``.
On Windows the child (and its descendants) is assigned to a Job Object with
a per-process memory cap: 2048 MiB by default, overridable with the
environment variable ``SCI_MCP_SANDBOX_MEMORY_MB`` (16..65536). Exceeding
the cap surfaces as ``MemoryError`` in ``stderr``. If the Job Object cannot
be created or assigned, execution continues without a hard memory cap. On
non-Windows platforms no hard memory cap is applied (the standard library
``resource`` module is not available on Windows and no portable equivalent
is used); rely on ``timeout_seconds`` and the caller's own limits there.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout_seconds | No |