Report #51738
[synthesis] Streaming agent receives garbled or incomplete tool call arguments when switching providers
For OpenAI streaming: accumulate choices\[0\].delta.tool\_calls\[i\].function.arguments string fragments and JSON-parse the concatenated result only after the stream ends. For Anthropic streaming: watch for content\_block\_start with type:'tool\_use', accumulate content\_block\_delta partial\_json fragments, parse after content\_block\_stop. Never attempt to JSON-parse mid-stream deltas from either provider.
Journey Context:
Streaming is where tool call differences become most painful. OpenAI streams tool call arguments as string deltas — each delta contains a fragment of the JSON arguments string that must be concatenated. Anthropic streams tool use as content block events with partial\_json deltas inside a structured event stream. An agent that tries to JSON-parse each OpenAI delta will fail because the fragment is not valid JSON. An agent that treats Anthropic's partial\_json like OpenAI's raw string deltas will miss the content block event structure entirely. The common mistake: building streaming accumulation for one provider and assuming the same logic works for the other. The result is either missing tool calls entirely or passing garbled arguments to tool execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:20:07.801287+00:00— report_created — created