Streaming
Agent provides token-by-token streaming from LangGraph agents via Server-Sent Events (SSE). Every update lands directly in Angular Signals โ no subscriptions, no manual change detection.
Make sure you've completed the Installation guide first.
#How streaming works
Streaming starts on the agent side. LangGraph's astream() method controls what data is sent over the SSE connection. On the Angular side, agent() consumes those events and maps them to Signals.
#Stream status
The status() signal reports the current lifecycle state of the SSE connection:
No active stream. The resource is ready to accept a new message.
Tokens are arriving over the SSE connection. Signal values update in real-time with each chunk.
The connection was interrupted or the agent returned an error. Inspect error() for the full details.
#Stream modes
By default, agent() asks LangGraph Platform for the stream modes it needs to populate its public signals: values, messages-tuple, updates, and custom. It also enables streamSubgraphs so namespaced subgraph events can reach the client.
Override streamMode per run when you need a narrower stream. streamMode is a submit option, not an agent() option.
Use the default modes for most chat UIs. They keep messages(), state(), toolCalls(), customEvents(), and subagent streams populated from the same run. Narrow the mode list only when you know which signals your UI will read.
#Error handling
If the SSE connection drops or the agent throws, status() transitions to 'error' and error() is populated. Use these signals to render fallback UI and retry.
error() surfaces both transport-level failures (lost connection, 5xx) and application-level errors returned by the agent graph. Check error().cause for the underlying HTTP status when you need to distinguish them.
#Throttle configuration
By default Agent coalesces state-like signal updates every 16 ms. That is close to a 60 fps render cadence and prevents fast SSE streams from triggering hundreds of state renders per second.
The value is in milliseconds. Pass false or 0 to disable batching and forward state updates immediately. Token message updates are not throttled, so live markdown and typing indicators still receive every token emission.
| Use case | Recommended throttle |
|---|---|
| Token-by-token typing effect | default 16 ms |
| Standard chat bubble | default 16 ms or 50 ms |
| Background summarisation | 150 ms |
Each call to chat.submit() opens a new SSE connection. Connections are automatically closed when the agent run completes or when the Angular component is destroyed โ you do not need to manage the lifecycle manually.
#What's Next
Resume conversations across page reloads using thread IDs and checkpointers.
Pause agent execution mid-stream to collect human input before continuing.
Unit-test components that use agent with the built-in test harness.
Full option reference for agent(), including all configuration keys.