Skip to main content

Module stop_loop

Module stop_loop 

Source
Expand description

stop_loop tool — let the agent end the event-driven loop itself.

In loop mode the agent keeps the loop alive by arming schedule_wakeup, a watch_file, or a pending run_background job. Until now it had no way to stop the loop — only the user could, via /loop stop. That made the loop lifecycle opaque to the user: they had to know to type /loop stop.

This tool writes a LoopControl::Stop onto the shared BackgroundJobManager. The TUI loop arbiter drains it between turns and exits loop mode, returning the TUI to normal interactive mode. So when the supervised command reaches a terminal outcome — or the user says “stop / exit the loop” in natural language — the agent calls stop_loop and the loop ends cleanly.

State lives on the shared background-job manager so the arbiter — which already holds that manager — can read it without a new shared slot.

Structs§

StopLoop
The stop_loop tool: agent-initiated loop shutdown.