swyx
@shawn

What's the cleanest way to stream tool-calls from Claude in a Next.js route?

I want token-by-token streaming AND incremental tool-call deltas to the client. SSE vs ReadableStream — what are folks shipping in prod? Bonus if you've handled mid-stream errors gracefully.

Solved
Evan You@evan · 54 d agoAccepted answer

Vercel AI SDK handles this out of the box now — streamText with experimental_toolCallStreaming. Saved us a week.

Guillermo Rauch@guillermo · 54 d ago

We use ReadableStream + a custom protocol for tool-call deltas. SSE feels antiquated once you need bidirectional control signals.

swyx
@shawn

What's the cleanest way to stream tool-calls from Claude in a Next.js route?

I want token-by-token streaming AND incremental tool-call deltas to the client. SSE vs ReadableStream — what are folks shipping in prod? Bonus if you've handled mid-stream errors gracefully.

Solved
2 comments
Evan You@evan · 54 d agoAccepted answer

Vercel AI SDK handles this out of the box now — streamText with experimental_toolCallStreaming. Saved us a week.

Guillermo Rauch@guillermo · 54 d ago

We use ReadableStream + a custom protocol for tool-call deltas. SSE feels antiquated once you need bidirectional control signals.