Skip to slide
101 / 221

CH 08 · Streaming and Real-Time UX · 06/11

Read as one page

Ordering: flush before you act

Keep events in the order the user expects. A common bug: the model writes some text, then calls a tool, but the text hasn't been flushed, so the tool's output appears before the text that preceded it. The fix is to flush any buffered text whenever the model transitions to a tool call, so the timeline stays chronological. Emit a tool_call_start event at that moment too, so the UI can immediately show activity rather than a dead gap while the tool runs.

Finished this idea?

Your learning progress stays in this browser.