string output and a stream<string> output. The script iterates pipeline.astream(...) and prints tokens as they arrive, then the final outputs once the run completes.
You’ll end up with. Live token streaming inside an asyncio event loop, terminating with a Final: {...} dict.
Expected output
StreamChunk has a discriminated type field ("stream" vs "result") — branch on it to separate tokens from the terminal outputs payload.
See also
Streaming
Synchronous SSE consumption.
Streaming with chunks
Same chunk shape, synchronous iteration.
Pipeline reference
Full method surface.
