Skip to main content

Module cancel

Module cancel 

Source
Expand description

Cooperative cancellation for a run.

A Cancel is a cloneable flag plus a wakeup. The caller (a CLI signal handler, the dashboard) sets it; the agent checks it at its own boundaries — before each provider request, before each tool call, and between iterations — and returns Error::Cancelled when it sees the flag.

It is cooperative on purpose: the run stops at the next check point rather than being aborted mid-write, so a cancelled run never leaves half-written records behind. What has already been written (the user message, any completed tool results) stays in the session, and the next run repairs an unanswered tool call.

Structs§

Cancel