AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Oct 12, 2026, 10:00 JST

HACH developer: safe agent cancellation needs 3 layers

HACH developer: safe agent cancellation needs 3 layers

3 Key Points

  1. What happened

    The HACH developer split response cancellation into three layers — output streaming, side effects, and state — and said the output layer alone is not enough.

  2. Why it matters

    Stopping only the output risks a cancelled turn where an email was already sent in the background, and unlogged tool calls can be re-run by mistake on the next turn.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

Cancellation is a problem of consistency rather than a simple stop button. While text generation can be cut at any moment by discarding unshown streaming output, tool calls that produce side effects — sending mail, updating a ticket — can only be interrupted at checkpoints before or after execution. A cancel signal that arrives mid-call is therefore left to finish, with the decision deferred to the next checkpoint.

A second concern is what the agent remembers. The design keeps a cancel-time record in both the conversation history and the user notice, distinguishing steps cancelled before execution from those already completed, and pointing to an undo path where one exists. Without that record, the next turn can misread the state and run the same action twice — the very duplicate-execution failure that cancelling was meant to prevent.

The design also draws a line between explicit and implicit cancellation. A new message that plainly says to stop triggers an immediate interrupt, but an unrelated request is queued so the current turn can finish, and ambiguous cases are allowed to complete because the inconsistency risk from interrupting outweighs a slightly verbose answer. The author notes this comes from building HACH, an agent that lives in Slack / Teams / Chatwork / LINE WORKS and collects chat, email, calendars and meeting notes for a daily morning report.

FAQ
When is it safe to interrupt a tool call?
Only before the call starts or after it finishes. If a cancel signal arrives while a tool is running, the design waits for that call to complete and stops before the next step.
What should happen if a cancel arrives after a tool already ran?
The design records it in the conversation history and tells the user which action was already executed, offering an undo procedure if one is available. If it is not recorded, the agent may think the tool never ran and repeat it.
How should the agent treat a new message sent mid-generation?
If the message clearly says to stop, it interrupts immediately. If it is an unrelated request, the current generation is not interrupted and the message is queued. When in doubt, the design lets the turn finish.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleBroadcom: ASIC revenue to double to $115 billion next year