Streaming
cascadeflow supports streaming responses viastream_events() for custom UI integration and run_streaming() for terminal output with visual feedback.
stream_events()
Returns an async iterator ofStreamEvent objects.
StreamEvent
| Field | Type | Description |
|---|---|---|
type | StreamEventType | Event type |
content | str | Content chunk (for CHUNK events) |
data | dict[str, Any] | Event metadata (model, phase, strategy, etc.) |
StreamEventType
| Value | Description |
|---|---|
START | Stream started |
CHUNK | Content chunk received |
TOOL_CALL | Tool call detected |
COMPLETE | Stream complete |
ERROR | Error occurred |
run_streaming()
Higher-level method with built-in visual feedback (pulsing dot indicator).Tool Streaming
When tools are involved, cascadeflow uses a tool-aware streaming manager:ToolStreamEvent
Tool-specific streaming event with additional fields.| Field | Type | Description |
|---|---|---|
type | ToolStreamEventType | Tool event type |
tool_call | dict[str, Any] | Tool call details |
tool_result | Any | Tool execution result |
content | str | Content chunk |