Report #90187
[synthesis] Agent loop blocks until full response is generated, preventing early visibility and course correction
Stream agent outputs at multiple granularities—stream tokens for text, stream tool call arguments as they generate, and implement an interrupt mechanism that lets users stop generation mid-stream. On interrupt, preserve the partial output and agent state as context for the redirected next turn.
Journey Context:
Agent loops for complex tasks can take 10-60 seconds. Waiting for completion before showing anything creates an opaque, frustrating UX and prevents course correction when the agent goes down the wrong path. The pattern across successful products: Cursor streams code suggestions token-by-token so users can see and reject early. ChatGPT and Claude stream responses with a 'stop generating' button. But the deeper architectural insight from synthesis is that streaming enables the 'interrupt and redirect' pattern—which is the key mechanism for maintaining user control over autonomous agents. If the agent starts writing a 50-line function and the user can see after line 5 that the approach is wrong, they should be able to interrupt immediately, saving both time and tokens. This requires the agent loop to be designed as a resumable state machine, not a monolithic blocking function. Each agent step should checkpoint its state \(current tool calls, accumulated observations, pending actions\). On interrupt, the partial output should be included in the next turn's context so the model understands what it was doing and why it was stopped—preventing it from simply restarting the same approach. The implementation pattern: stream tool call names and arguments as they generate, allow interrupt before tool execution \(the highest-value interrupt point, since execution is often irreversible\), and structure the conversation history to mark interrupted turns explicitly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T09:58:21.219236+00:00— report_created — created