Parallel tool calling

message in flightlatency
LLMHostget_weathertoolfx_ratetooltool_use #1, #2tool_result #1, #2SerialLLMtool 1LLMtool 2LLMParallelLLMtools 1+23 LLM turns2 LLM turns
  1. The model emits a structured tool_use block with an ID.
  2. The host validates and dispatches the call.
  3. tool_result returns, matched by tool_use_id.
  4. Independent calls fan out in one turn, saving a round-trip.
Notes & references

Use when

Independent, read-only lookups.

Avoid

Concurrent calls with data dependencies or side effects.

# one model turn, two independent requests
reply.tool_calls = [
    { id: "1", name: "weather", input: { city: "Paris" } },
    { id: "2", name: "fx_rate", input: { pair: "EUR/USD" } },
]

# your code runs both at once
results = await gather(*[run(c) for c in reply.tool_calls])

# each result carries its matching id
messages.append([{ id: c.id, content: r } for c, r in ...])