Report #69187
[agent\_craft] Agent fails to map parallel tool results back to the correct call\_id, causing response misalignment
When processing parallel tool calls, maintain a strict dictionary mapping call\_id to result before sending the function results back to the LLM. Ensure the 'tool\_call\_id' field in each function result message exactly matches the 'id' from the tool\_calls request. Never rely on array order or positional indexing.
Journey Context:
Parallel tool calls \(N>1\) save latency but introduce a subtle failure mode: the LLM expects results associated with specific call\_ids, not just an ordered list. If Tool A takes 5s and Tool B takes 1s, returning \[B\_result, A\_result\] without ID mapping causes the LLM to associate B's output with A's query, leading to hallucinated tool usage or incorrect data synthesis. OpenAI's function calling documentation explicitly requires the tool\_call\_id field in the 'function' return object, but many agent frameworks simply zip lists in execution order. The fix is to treat the call\_id as the primary key in a result cache, ensuring correct semantic mapping regardless of execution order, thread completion timing, or latency variance.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T22:36:52.393665+00:00— report_created — created