Session Run
session_runExecute a multi-file program in a session workspace with correct relative imports and data file resolution. Returns output, verdict, and created artifacts.
Instructions
Run a multi-file program already written into a session workspace
(via session_write_file). Use this, not
execute_code/execute_code_stream/run_submit, when entry_file may
import other files already in that workspace (helper.py, data/...).
Runs as a fresh process in the session workdir (not the REPL worker), so
relative imports and data files resolve. Returns stdout/stderr/verdict
plus the entry file's path. Oversized output spills into the session
workspace the same way execute_code's does — see its docstring for
stdout_spill/stderr_spill.
Reports artifacts_created and inlines small ones as extra content
blocks (image/text/link), capped at 8 blocks / 4 MiB encoded;
truncated_inline: true past either cap. dependencies installs
packages before running, same rule as execute_code's — see its docstring.
This tool takes no max_output_kb (its inline stdout/stderr stay at the
64 KiB default and spill past that, same as execute_code's session
branch) but the anthropic/maxResultSizeChars _meta it advertises
covers only that text envelope — the JSON result serialized as the
reply's content text block. The inlined artifact blocks above
(image/text/link, up to 8 of them within the 4 MiB encoded budget) are
SEPARATE MCP content blocks, outside the text block this hint bounds.
Every run copies entry_file's own source into the runner's private
scratch subdirectory before executing it — never into a root-level
main.<ext> file a session's own files could collide with. A session's
own main.py (or the equivalent for another language) at the session
root is never touched by running a different entry file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stdin | No | Text piped to the program's standard input; empty means no input | |
| timeout | No | Wall-clock seconds before the run is killed | |
| language | No | Language to run `entry_file` as; omit to infer it from the session/file | |
| entry_file | Yes | Relative path of the file to execute; may import other files already in the workspace | |
| session_id | Yes | Id of the session workspace to run in | |
| dependencies | No | Packages to install before running, e.g. ['requests==2.31.0'] |