When the model calls a function, your code must execute it and return the result, and since model responses can include zero, one or multiple calls, it is best practice to assume there are several. Claude models run independent tool calls in parallel, and the OpenAI API returns several function_call entries in one response, each with its own call_id. Parallel calls save turns when the calls do not depend on each other, but they only work for independent calls: a call that needs another call result must wait for the next turn.
What you need
- Two or more tools the model can call
- A check that the calls are independent of each other
- Code that matches each result to its call_id
Step 1: Declare the independent tools together
Define the tools in one request, with clear descriptions of when each applies. The model can only call in parallel the tools it can see in the same request.
Step 2: Execute every call in the response
Loop over the function_call entries in the response and execute each one, keeping the call_id with each result. Do not stop after the first call: the model may have issued three.
Step 3: Send all results back in one message
Append each result as a function_call_output with its call_id, then make the next request. The model then writes the final answer from all the results at once.
Worked example: synthetic parallel calls for a trip question
The table below is a synthetic example. It shows the expected result of parallel tool calls; no call was made.
| Call | Depends on another? | Runs when |
|---|---|---|
| get_weather Paris | No | Same turn |
| get_weather Bogota | No | Same turn |
| send_email summary | Yes – needs both forecasts | Next turn |
| Result | 2 calls in turn 1 | Email in turn 2 |
Expected result (UNTESTED). the two weather calls run in parallel in the first turn, and the email waits for the next turn because it needs their results. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Parallel calls only work for independent calls; a call that needs another result must wait.
- For reasoning models, any reasoning items returned with tool calls must also be passed back with the tool call outputs.
- On Claude, a turn with many parallel tool calls still counts as one position in the prompt-caching lookback window.
- If one call fails, return the error as its result so the model can decide what to do, rather than dropping the whole turn.
