Report #82274
[synthesis] Agent crashes parsing incomplete tool call arguments during streaming
Buffer all streamed tool call argument fragments until the stream signals completion before attempting JSON.parse. OpenAI streams tool\_calls\[\].function.arguments as incremental JSON string fragments. Anthropic streams content\_block\_delta events with partial\_json deltas. Never parse mid-stream tool arguments.
Journey Context:
During streaming, tool call arguments arrive in fragments and the parsing behavior differs per provider. OpenAI sends arguments as raw string chunks — you might receive '\{"lo' then 'catio' then 'n": "P' — requiring concatenation before any parsing. Anthropic sends input\_json\_delta events that provide structured partial JSON but still cannot be parsed independently. The critical cross-model insight: OpenAI's argument fragments are raw JSON string pieces with no structural boundary signals until the done event, while Anthropic's content\_block\_stop event signals when a complete tool\_use block has been received. Agents that try to parse each chunk independently will throw JSON parse errors. The fix is to accumulate the full argument string/object, but this creates a latency tradeoff: the agent cannot act on partial tool call information mid-stream, meaning streaming provides UX benefit but not execution-speed benefit for tool calls.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:41:25.690668+00:00— report_created — created