Decide what the user should see while waiting

Consider an assistant drafting a service summary. Showing text as it arrives can give the user something to read before the entire response is available. Our recommendation is to label that text as a draft in progress and explain when it becomes ready for review. Choose this behaviour because it helps the task, then measure it. Do not assume streaming makes the underlying model finish sooner or reduces the cost of a request.

Follow the service’s completion signals

Anthropic’s Messages API can stream responses incrementally using server-sent events. Its documented flow includes content updates and a final message_stop event. The documentation also describes errors that can arrive within the stream. A first fragment therefore cannot establish successful completion. Our suggested implementation keeps separate states for generating, completed and interrupted, and checks the final message before presenting the result as ready. Anthropic: Streaming messages.

Check why generation stopped

Anthropic’s stop_reason distinguishes a natural end of the response from outcomes such as reaching the output-token limit or requesting a tool. Reaching a limit can leave an answer truncated. Our recommendation is to validate completeness for the intended task as well as checking the service’s status. A naturally ended response still needs the application’s quality checks; a partially written summary should not silently become the final customer record. Anthropic: Stop reasons and fallback.

Give interruptions a visible recovery path

For a network loss or generation error, our proposed interface retains clearly marked partial text, explains that it is incomplete and offers an appropriate recovery choice. Keep a new attempt distinguishable from the previous attempt. Test how the interface behaves when the user leaves the page, stops generation or returns after a connection failure. Any connected business action should require its own validated input and authorisation before it runs.

Measure a complete and usable experience

In a representative pilot, measure time to the first visible text separately from time to a usable final answer. Review interrupted sessions, incomplete results and the effort needed to recover. Include keyboard navigation and assistive technology in the interface review, especially when text updates frequently. Expand the workflow only after these checks support its intended use. These are proposed acceptance criteria, with no claim of measured client performance or guaranteed reliability.

Sources & further reading