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
Types that earn their keep
Most TypeScript adds ceremony without removing bugs. Four patterns that make illegal states unrepresentable instead of merely annotated.
Article6 min
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