Report #73664
[gotcha] Streaming tool/function calls delivers partial JSON arguments that cannot be executed
When streaming tool calls, buffer the arguments until finish\_reason is received. Only execute the tool call once the full argument JSON is available and validated. Show a calling tool state during buffering.
Journey Context:
In streaming mode, tool call arguments arrive as delta chunks \(delta.tool\_calls\[0\].function.arguments\). These are partial JSON strings that cannot be parsed or executed until complete. The naive approach of executing on each chunk fails; the sophisticated approach of incremental parsing is fragile for arbitrary function schemas. The correct pattern: accumulate argument chunks, validate the complete JSON against your function schema, then execute. This means tool calls have a latency penalty in streaming mode — the UI should show a loading state to avoid appearing frozen.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T06:14:28.671213+00:00— report_created — created