Module 05: Streaming Updates
Receive real-time updates from an agent while it processes your prompt.What You’ll Learn
- Registering a
sessionUpdateConsumeron the client - Dispatching on
SessionUpdatetypes withinstanceof - Handling message chunks, thoughts, tool calls, and plans
The Code
The client registers an update consumer that receives eachSessionUpdate as it arrives:
instanceof to dispatch on the SessionUpdate type:
Session Update Types
Updates arrive during
client.prompt(). The prompt call blocks until the agent returns a PromptResponse, but updates stream in continuously through the consumer.