llm function_calling ai_generated true

Tool results conflict — parallel tool calls create race condition

ID: llm/tool-calling-parallel-race-condition

Also available as: JSON · Markdown
80%Fix Rate
85%Confidence
4Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

LLM issues multiple tool calls in parallel that modify the same resource.

generic

Workarounds

  1. 85% success Detect resource dependencies and serialize conflicting tool calls
    Group tool calls by target resource; run independent groups in parallel

    Sources: https://platform.openai.com/docs/guides/function-calling

  2. 82% success Make tool implementations idempotent and conflict-safe
    Use optimistic locking or compare-and-swap patterns

    Sources: https://platform.openai.com/docs/guides/function-calling

Dead Ends

Common approaches that don't work:

  1. Execute all parallel tool calls concurrently as requested 75% fail

    Concurrent execution of dependent tool calls causes race conditions

  2. Ignore the parallel flag and run sequentially always 60% fail

    Running everything sequentially defeats the performance benefit