Expand description
A plugin’s declared Python tools (tools[].run): the model’s arguments go to the
script as JSON on stdin; what it prints (plain text, or {"text": …, "files": […]})
goes back. Settings arrive as environment variables, plus HOB_CHAT_DIR and
HOB_PLUGIN_DIR (and BYOB_* aliases).
Given a Sandbox (PythonTool::with_sandbox), scripts run confined by
byob-sandbox (run_script_sandboxed: workspace + temp writable, plugin folder
readable, network only if the plugin declares permissions.network). Without one
they’re a plain child process (run_script_unsandboxed). Either way: timeout,
bounded output, process-group kill, and Access::Execute so the permission gate asks.
Structs§
- Python
Tool - A plugin’s Python tool.
- Script
Outcome - Script
Run - One script run.
Constants§
- MAX_
SCRIPT_ OUTPUT - Most bytes kept from each of stdout and stderr.
- SCRIPT_
TIMEOUT - hob’s limit for a plugin tool.
Functions§
- default_
python - The interpreter a Python tool runs with, as a command prefix.
- fill_
title "Converted {amount} {from}"+ args →"Converted 5 EUR"; unknown keys stay.- python_
tools - The Python tools
plugindeclares, named as declared (so the plugin’spromptstill matches) or<plugin>__<tool>when that name is taken. Tools whose script is missing are left out (the plugin’sproblemssay so). - python_
tools_ in python_toolswhose scripts run insandbox(when given).- run_
script_ sandboxed - Run a script in
sandbox: read the system, the plugin folder and the interpreter; read+writerun.cwd(the workspace) and a private temp folder; network only ifnetwork. The environment is reset to a minimal one plusrun.env. - run_
script_ unsandboxed - Run a script as a plain child process: no sandbox. Kills it (and its process
group) on timeout or when
cancelled()turns true.Erronly when it couldn’t start.