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
LangGraph supports three stream modes. Pass streamMode to control what each SSE chunk contains.
Use values for most chat UIs โ it gives you a consistent, complete state snapshot. Switch to messages only when you need sub-token latency or are rendering a live typing cursor.
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 emits a signal update for every incoming SSE chunk. On fast connections this can trigger hundreds of renders per second. Use the throttle option to coalesce updates.
The value is in milliseconds. A throttle of 0 (default) disables batching and passes every chunk through immediately. Good starting values:
| Use case | Recommended throttle |
|---|---|
| Token-by-token typing effect | 0 ms (disabled) |
| Standard chat bubble | 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.