Streaming
CascadeAgent supports streaming via streamEvents() and stream() async iterators.
streamEvents()
StreamEvent
| Field | Type | Description |
|---|---|---|
type | StreamEventType | Event type |
content | string | Content chunk (for CHUNK events) |
data | StreamEventData | Event metadata |
StreamEventType
| Value | Description |
|---|---|
ROUTING | Routing decision made |
CHUNK | Content chunk received |
DRAFT_DECISION | Draft quality validation result |
SWITCH | Switching from drafter to verifier |
COMPLETE | Streaming complete |
ERROR | Error occurred |
StreamEventData
| Field | Type | Description |
|---|---|---|
model | string | Current model name |
phase | string | Current phase ("draft" or "verify") |
strategy | string | Routing strategy used |
accepted | boolean | Whether draft was accepted (on DRAFT_DECISION) |
cost | number | Running cost (on COMPLETE) |
StreamEventsOptions
Same asRunOptions — all parameters from agent.run() are accepted.