Streaming and typing indicators
The web widget uses Server-Sent Events (SSE) to stream assistant replies token-by-token and show typing indicators while the model and tools work.
Visitor experience
Section titled “Visitor experience”| Phase | UI |
|---|---|
| Message sent | Typing indicator appears |
| Model streaming | Text renders incrementally |
| Tool running | Status notifications may show progress text |
| Tool success + transform | Rich content cards append after or alongside text |
| Complete | Typing indicator clears |
SSE vs polling
Section titled “SSE vs polling”SSE keeps a single long-lived connection for the turn — lower latency and smoother UX than polling. Direct API clients can also consume stream endpoints; see SSE events.
Tool + stream ordering
Section titled “Tool + stream ordering”| Execution | Stream behavior |
|---|---|
| sync tool | Stream may pause until tool returns, then continue |
| async tool | Status lines first; final answer streams when ready |
Configure execution mode per tool for long-running APIs.
Rich content delivery
Section titled “Rich content delivery”Structured cards arrive as dedicated stream events after successful tool JSON is transformed — not mixed into markdown the model invents. Trust policy.
Testing
Section titled “Testing”- Create widget deployment on staging.
- Ask a question that triggers streaming only, then one that triggers a tool.
- Confirm typing indicator and card timing feel acceptable on mobile networks.