background_command
Last updated
The tool that starts a command in the background and reports its output while it runs and when it exits.
| Tool | Description |
|---|---|
background_command | run_command_background was renamed background_command (Removed in v1.3.2). Added in v1.3.1 as run_command_background; v1.3.0 shipped the same behavior as a background mode of run_command, which now runs in the foreground only. Takes the same argv, network, write_paths and sandbox parameters (plus objective and next since v1.3.8) under the same sandbox, confirmation, read-only allowlist and allow-rule checks (and, since v1.5.0, the same Command network switch), and returns a task id at once so the turn continues. Meant for a file watcher (which runs only here), a job very likely over 5 minutes whose output does not decide the next tool call, or 跑完告訴我 / 背景跑. timeout_min (1-60, default 60) kills the command and reports a timeout; the final report keeps the last 31 KiB of output. The output is always watched: a new output line containing one of keywords (case-insensitive; default error, err!, fail, fatal, panic, exception, traceback, segmentation fault, core dumped, out of memory, permission denied, command not found, no such file) reports the latest output (up to 8 KiB) while the command keeps running, once the output settles (2 s of quiet, at most 10 s), and at most one report per 30 s. With a decision model set, a decision check first drops benign hits (such as 0 errors) and repeats of the last report; a failed check sends the output unchecked with the failure noted. Without a decision model every hit is reported. The interval and prompt parameters were Removed in v1.3.2; use keywords instead. While the command runs, its output is appended to ~/.config/agenvoy/sessions/<session>/background/<task id>.log, which is removed when the command ends; the start result gives that path and tells the agent to read its tail with read_files when asked how far it got. Excluded unless the request comes from the TUI (cli- origin with no deliver target) — since v1.3.2 no longer tied to having a decision model. Each session runs at most MAX_BACKGROUND_TASKS background tasks (DEFAULT_CONCURRENCY: half the CPU cores, at least 3), a pool shared with background_subagents. Since v1.3.8 legs started in the same turn form one group: its reports go to the starting task while that task is running or pending, and once it has ended the group runs objective + next + every report as a new task when all its legs finish (before, each finished task resumed the original task on its own). Pausing or cancelling the starting task stops its legs; a single leg is cancelled from the TUI Esc menu |