Streaming changes the parsing problem
When you stream a structured output, you get partial JSON: {"verdict": "app… and so on. A naïve json.loads() fails on every chunk. The pipeline has to either buffer until done or parse incrementally with a streaming JSON parser.
Why stream
- UX — show the user something within 200ms instead of after 8s.
- Pipelining — start downstream work on the first complete field instead of after the last.
- Cancellation — kill the request as soon as the user navigates away or the verifier rejects.
Failure modes specific to streaming
- Truncation halfway through a JSON output (max_tokens, network drop).
- Tool calls that arrive in pieces (start, deltas, stop).
- Reasoning tokens streaming separately from output tokens.
- Cancellation races — if the consumer disconnects, your code keeps running unless you wire cancellation through.