Stream in one line
Setstream=True so users see progress as the agent works.
Streaming with Tools
Streaming works with tool-calling workflows. You can stream while the agent calls local tools, MCPs, or both.Compare: non-streaming vs streaming (same scenario)
The scenario below is the same in both snippets. The only difference is whether you setstream=True and iterate over the stream.
In Python, non-streaming refers to
stream=False, not “sync”. If you use AsyncDedalus,
you’ll still write async code and use asyncio.run(...). If you prefer fully synchronous code,
use the Dedalus client (example below).Python
Python (sync client)
TypeScript
How the user experience differs
- Progressive rendering: you can display text as it arrives (“typing”), instead of waiting for a complete response.
- Visible work: in tool/MCP workflows, you can show status updates (e.g., “Searching Ticketmaster…”) while the agent is calling tools.
- Interruptibility: you can stop early (client-side) if the user already has what they need, instead of paying for a full completion.
When to Stream
Stream when:- Building chat interfaces where perceived latency matters
- Generating long-form content (articles, code, analysis)
- Running in terminals or logs where progress feedback helps
- You need to parse the complete response before displaying
- Using structured outputs with
.parse() - Response time is already fast enough
Next steps
Handoffs
Use fast/strong models by phase
Images & Vision
Add multimodality when your text workflow is solid
Use Cases
More streaming agent examples
