LLMs, GenAI, RAG, agents, evaluation · insight-1575
Make cancel a first-class operation that stops the loop, reaches running tools and reports what already happened
- Evidence type
- practitioner heuristic
- Difficulty
- medium
- Roles
- ML engineer, Applied AI
- Industries
- saas, logistics
Summary: situation, action, reason, boundary
Situation
A user presses stop on a long agent run that has already issued several writes and has a slow search in flight.
Action
Check a cancellation flag between steps, pass a cancel signal or deadline to tool calls that support it, let an in-progress write finish or undo cleanly, and return a summary of completed, cancelled and pending steps.
Reason
Cancelling the visible stream does not cancel work already dispatched, so state and user belief diverge unless the system reports the true outcome.
Boundary
Interactive or long-running agents that perform writes.
Symptom or risk
The loop keeps running or the in-flight tool completes unseen, and the user does not know which changes were applied.
Exceptions
Short read-only runs can simply be dropped.
Trade-offs
Cancellation paths add code and need testing under failure.
Pitfalls
A stop button that only hides the output while the run continues.