SequentialWorkflow exposes two streaming methods that yield tokens from each agent in pipeline order, in real time. Each agent’s tokens are streamed the moment the LLM produces them; once an agent finishes, its full output is handed off to the next agent — same hand-off as run(), just streamed.
workflow.run_stream(task) — sync generator
workflow.arun_stream(task) — async generator
- Pass
with_events=True to either to receive structured agent_start / token / agent_end events instead of plain token strings.
Building the Pipeline
Sync Streaming
Plain token strings, yielded in pipeline order. Agent 1’s tokens stream first, then Agent 2’s, then Agent 3’s.
Async Streaming
Structured Events with with_events=True
By default the stream yields plain token strings. Pass with_events=True to receive event dicts instead — useful when you want to render a separate panel per agent, attribute every token to the emitting agent, or know exactly when each agent starts and finishes.
The three event types are:
max_loops > 1 and drift_detection are not applied in streaming mode. Use workflow.run() if you need those.