Expand description
The sandbox-routed python_repl tool.
Each call pipes the code to a fresh interpreter in the sandbox, so variables, imports and definitions do not persist across calls; files written to the sandbox do.
Structs§
- Make
Python Repl Options - Options for
make_python_repl(MakePythonReplOptions). - Make
Python Repl Options Builder - Use builder syntax to set the inputs and finish with
build(). - Python
Repl Error - The sandbox failed to run the code (
PythonReplError), for example an unreachable container. Errors in the code itself are results witherrorand a non-zeroexit_code. - Python
Repl Output - What the interpreter produced (
PythonReplOutput). - Python
Repl Timeout Error - The code exceeded its timeout: the sandbox’s
SandboxTimeoutError(thesource) with the partial output appended to the message as JSON with exit code 124, because the model sees only the message.
Constants§
- PYTHON_
REPL_ DESCRIPTION - The description of the
python_repltool shown to the model (PYTHON_REPL_DESCRIPTION).
Functions§
- make_
python_ repl - Creates a sandbox-routed Python tool: it runs
codewith the sandbox’sexecute_codeand returns aPythonReplOutputas JSON. - python_
repl - The default
python_repltool, running in the calling agent’s sandbox.