Can streaming merge two parallel tool calls into one with garbled arguments?
Yes, with some providers. A model streams a tool call’s arguments in pieces tagged with an index, so the client knows which call each piece belongs to. When two parallel calls share the same index instead of getting one each, a client that keys its accumulator by index alone concatenates both calls’ arguments into one call with invalid JSON, or keeps only the last id it saw and silently drops the other call.
Swarms hit exactly this against Gemini: Gemini streams every parallel call in a turn at index 0, while OpenAI and Anthropic assign a distinct index per call and don’t trigger it. The bug surfaces only once a client built and tested against one of those two providers gets pointed at Gemini, since the index-per-call assumption holds right up until then.
Keying the accumulator by id when one is present, and starting a new call whenever an id changes mid-turn instead of merging into an existing slot, fixes it in the client’s chunk-accumulation code. It’s the kind of assumption a harness carries about the model underneath it that only breaks once you swap providers.
published