Report #29951
[synthesis] Streaming tool call deltas require provider-specific assembly — partial tool calls cause execution errors
Buffer all streaming deltas for a tool call until the complete call is assembled before executing. OpenAI streams tool\_calls as delta fragments with index-based assembly — accumulate function.name and function.arguments strings per index. Anthropic streams content\_block\_start with tool id and name then content\_block\_delta with partial JSON input — accumulate per content block index. Never execute or display a tool call from a partial stream.
Journey Context:
Both OpenAI and Anthropic support streaming responses including tool calls, but the delta formats and assembly logic differ significantly. OpenAI sends tool\_call deltas as indexed fragments where function.arguments accumulates as a JSON string across multiple chunks. Anthropic sends a content\_block\_start event with the tool use block header including id and name, then content\_block\_delta events with partial input\_json strings. Attempting to parse or execute a tool call before the stream completes results in malformed JSON or missing parameters. The practical impact: agent UIs that show tool calls in progress need provider-specific assembly logic, and agent executors must wait for stream completion indicated by stop\_reason in the final event before invoking tools. Getting this wrong causes JSON parse errors and failed tool executions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:39:50.278457+00:00— report_created — created