ui_stream
Stream agent completion summaries to WebSocket UI clients. Used with host() for real-time updates in web chat interfaces.
When an agent finishes a turn, sends a completion event to the WebSocket client: tools used, LLM calls made, total iterations.
Quick Start
main.py
Completion event payload
Sent to the WebSocket client when each turn completes:
code
Other streaming events
Individual events are emitted directly from their sources — ui_stream only adds the final summary:
| Event type | Emitted by | When |
|---|---|---|
| thinking | agent.py | Before each LLM call |
| tool_result | tool_executor.py | After each tool call |
| assistant | agent.py | When agent responds |
| complete | ui_stream plugin | When turn finishes |
Does nothing when agent runs locally without a WebSocket connection (if not agent.io: return).
Events used
| Event | Handler | Purpose |
|---|---|---|
on_complete | stream_complete | Send completion summary to WebSocket |
