agentix.control¶
control ¶
Run control — cooperative interruption.
Pass an :class:Interrupt to Agent.run / Agent.stream and call
trigger() from anywhere (another task, a signal handler, a UI button) to
stop that run. The loop checks at the top of each step — a safe boundary,
after a complete model+tools round — so an in-flight model call or tool finishes
first, then the run ends with status="aborted", reason="interrupted".
This is per-run state, so one Interrupt controls exactly one run. For hard,
immediate cancellation, cancel the asyncio task instead.