Lesson 14.01 · Phase 14 · Agent UX & Interfaces
Streaming UIs for agents
An agent that works for thirty seconds in silence feels broken, even when it isn't. Stream what it's doing as typed events, and make the stream survive a dropped connection.
Learning objectives
- Design an event protocol for agent runs (run.started, step.started, tool.started, tool.finished, text.delta, run.completed) that a UI can render without knowing the agent's internals.
- Serve it as server-sent events from an append-only event log, with ids, retry, and keep-alive comments.
- Resume after a dropped connection with Last-Event-ID: no duplicates, no gaps.
- Measure what streaming changes: time until the user sees progress, compared with total run time.
Phase 0 streamed tokens from one model call. An agent run is different: it's several model calls and tool calls, and most of the waiting happens between tokens, while a tool runs. Streaming only the final answer's tokens still leaves the user watching a spinner for most of the run.
Loading the full lesson…