Build a streaming tool loop with the Claude API
A production-shaped agent loop in TypeScript: typed tools, streamed output, human approval gates, and the pause_turn case that silently truncates answers.
Tutorial9 minadvanced
Streaming is a state machine, not a string
The token loop is the easy part. Reconnects, partial JSON, backpressure, and the abandoned-request problem are where streaming implementations actually break.
Article7 min