A customer service agent initiated two tool calls in a single reply: updating a contact’s phone number and sending an SMS notification. Both returned 200, but the SMS still went to the old number. Looking at the logs afterward, both calls landed in the same concurrent batch, and the SMS step read the record from before the update.
This isn’t the model choosing the wrong tool. Its judgment at the time was reasonable: the two actions appeared independent. The problem is that the orchestration layer packed two write operations that should have been sequential into the same batch, and the backend provided no mechanism to stop it.
Parallel tool calls (one model reply returning multiple tool calls, executed concurrently by the orchestration layer) are pure upside in read-only scenarios, and in write scenarios they’re a bet with no hedging agreement.
What you save is a few hundred milliseconds; what you lose is order
First, the savings. Four independent queries, each taking about 400 ms, are 1.6 seconds serially and 400 ms in parallel, plus one model round trip. On the order of a second saved. For an interactive product, a second can turn “this is a wait” into “this is fine”—a real experience improvement.
Now the losses. In the example above, the SMS went to the wrong number, costing one user complaint plus one manual follow-up call—tens of yuan. But if the two parallel writes are “decrement inventory” and “create order,” or “initiate refund” and “close ticket,” the magnitude is completely different: a duplicate refund is hundreds to thousands of yuan, plus manual reconciliation, plus the time spent in downstream finance processes.
What’s really expensive isn’t the per-incident amount; it’s that these errors can’t be rolled back. Get a read wrong and you just read again—cost near zero. Get a write wrong and you either need a reverse action (a refund can be clawed back, but the customer has to cooperate) or you need manual intervention. And concurrency-induced errors are precisely the hardest kind to detect: both calls return success, and the logs are clean.
There’s also a hidden cost that rarely gets mentioned: the model loses the chance to change its mind mid-batch. In a serial loop, the second step can see the first step’s return before deciding what to do; a parallel batch is a one-shot decision—the model locks in all actions the moment it emits the calls. Reading “insufficient inventory” and then reordering from another warehouse is impossible in a parallel batch. Part of that saved second is paid for with adaptability.
The model’s basis for judging “independent” is thinner than you think
The model decides how many calls to parallelize based on only two things: the tool descriptions (name and description in the schema) and the strings in the current context. It can’t see the backend’s shared state, can’t see row locks in the database, and can’t see that two tools actually sit on top of the same table.
So when it judges “these two calls are independent,” it’s essentially making a guess from description text. No matter how detailed the descriptions are, update_contact and send_sms are literally two different actions, and nothing tells the model they share a phone number field.
Some say: just write the dependency into the description. You can, but the description is part of the prompt, and its binding force decays as context grows and gets diluted over multi-turn conversations. Betting system consistency on the model remembering the constraint in the description every time is building correctness on a single sample.
The API layer’s parallel switch helps only marginally here. Mainstream APIs do offer a parameter to disable parallelism, but it’s a global switch: either all tools may be called concurrently or none can. What you actually need is per-tool granularity—concurrent reads, serial writes—and that granularity can only be implemented in the orchestration layer.
No transactions, but you can make conflicts fail explicitly
Concurrent writes lacking transaction semantics won’t change anytime soon. Tool calls are close to HTTP semantics: no begin/commit, no isolation levels, and certainly no distributed transactions across services.
If you can’t get transactions, you can get something cheaper: make conflicts fail instead of letting them pass silently.
The concrete approach is to add preconditions to every write operation. Updates carry an expected_version or ETag, decrements carry “balance >= X,” state transitions carry “current state must be A.” The backend returns an explicit conflict error when the condition isn’t met, rather than overwriting last-write-wins.
This isn’t new technology; it’s optimistic concurrency control, used in databases for decades. Its value here is turning silent errors from concurrent writes into a visible failure. A failure can be caught by the orchestration layer, seen and retried by the model, or routed to alerts. Silent overwrites can’t—you often have to reconstruct what happened days later from user complaints.
The cost is more complex retry logic, and some requests that would have succeeded get rejected. What that cost buys is a lower bound: in the worst case you get a failure instead of a bad row. For a write involving money, I think the trade is worth it; for adding a tag, it isn’t—a version check just slows down the whole path.
Partial success is the hardest part of concurrent writes
Suppose a batch has five writes: three succeed, two fail. Now you have to decide what to return to the model.
Return all errors and the model thinks the whole batch failed and retries, redoing the three that already succeeded. Return only the two failures and the model doesn’t know the state of the other three and may re-initiate them in its next reply. Mark all five as successful and you’re lying to yourself.
Serial execution has the same problem, but its blast radius is smaller: only one call is in flight at a time, so you can stop at the failure and the rest never go out. A parallel batch throws all five out at once—you don’t even have the “stop” option.
flowchart TD
A[批次执行结束] --> B{全部成功}
B -->|是| C[标记幂等键已完成]
B -->|否| D[编排层汇总各调用状态]
D --> E{失败项可重试}
E -->|否| F[停止并转人工]
E -->|是| G[只重发失败项]
G --> H[成功项禁止二次执行]My approach is to have the orchestration layer, not the model, hold this state. The structure returned to the model for the batch carries three things: the status of each call, an idempotency key, and explicit next-step instructions (which can be retried, which must not). Meanwhile the orchestration layer maintains the set of calls already executed this round, and the same idempotency key cannot be executed twice within a round.
The idempotency key must be constructed from the batch identifier and a hash of the parameters, not just the tool name. Otherwise, if the model retries with different parameters, the key stays the same and you’ll block a legitimate retry as a duplicate request.
Compensating actions must be thought through in advance. If one of the three successes is “notification sent,” you can’t take it back—you can only send a correction. Which write operations have reverse actions and what those reverse actions cost is a list you have to write when you onboard the tool, not after an incident.
Queue by reversibility, not by feel
I judge whether a tool can enter a concurrent batch on one dimension only: can a mistake be undone at low cost?
flowchart TD
A[一次返回多个工具调用] --> B{包含写操作吗}
B -->|不含| C[并发执行并设上限]
B -->|包含| D{可幂等重放吗}
D -->|否| E[拆成多轮串行]
D -->|是| F{有跨资源不变量吗}
F -->|有| E
F -->|没有| G[并发执行带版本校验]| Level | Typical tools | Concurrency policy |
|---|---|---|
| Read-only | Queries, search, file reads | Concurrent by default, with a concurrency cap |
| Idempotent writes | Upsert by ID, overwrite-style config writes | May be concurrent, must carry idempotency keys |
| Reversible writes | Create draft, add tag | May be concurrent, but must be locatable and rollback-able |
| Irreversible writes | Payments, refunds, sending messages, deletes | Serial, one per round |
| Cross-resource writes | Decrement inventory and create order, transfers | Serial, with precondition checks |
In configuration, the granularity is the individual tool, not the whole application:
1 | tools: |
The concurrency limit column is easy to overlook. Even for pure reads, parallelism amplifies the request peak by N times; once you hit a third-party rate limit, you enter retries, and retries amplify the peak again—the end result being “adding concurrency made it slower.” Set the limit based on the callee’s quota, not on the latency you hope for.
Serial execution isn’t free either. Every serial step adds another round trip to the model, on the order of one to three seconds depending on the model and context length. For irreversible writes, that cost is worth paying; for reversible writes, it’s wasted. So the point of tiering isn’t “being conservative”—it’s spending the latency budget where ordering is genuinely needed.
When parallel writes are valid
There are a few boundary conditions; when they hold, I’ll allow concurrent writes.
Resources are completely disjoint, and no invariant spans them. For example, appending a paragraph to each of five unrelated documents, with no constraint crossing them. Once a constraint like “these two fields must sum to a certain value” appears, the disjointness premise no longer holds, even if the resource IDs differ.
The write itself is idempotent, and the idempotency key is generated by the caller. Replaying the same request any number of times yields the same result. In the worst case, this kind of concurrency wastes a call; it doesn’t leave behind a bad state. Note that the caller generates the key, not the backend deriving it from parameters—the latter produces a new key when parameters are tweaked slightly.
The whole batch can accept “partial success” semantics, and the user can see it. In scenarios like bulk import or bulk tagging, returning “8 succeeded, 2 failed, row 3 has a format error” is something users can understand and fix themselves. But if the user’s mental model is “all or nothing,” then partial success is failure.
Conversely, there are several kinds of operations I basically never let into concurrent batches: those with conservation relationships like balances and inventory, those with state machines like approvals and tickets, those that can’t be taken back once sent like messages and emails, and any cross-service write. The common thread is that the cost of a conflict far exceeds the latency gain, and the conflict is invisible at the time.
One action you can take right now: pull out your existing tool list and annotate each write operation with a sentence on “how to undo it if done wrong.” For any where you can’t identify an undo path, remove it from the concurrent batch first. This step doesn’t require changing the architecture—just one judgment in the orchestration layer.
Parallelism itself isn’t wrong; what’s wrong is treating it as a global switch. Reads and writes gain latency benefits of the same order of magnitude, but differ by orders of magnitude in risk.
References
- OpenAI function calling documentation on parallel_tool_calls: https://platform.openai.com/docs/guides/function-calling
- Anthropic tool use documentation (multiple tool calls and result passing): https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview
Comments