DEV Community

Cover image for I let my agent call its tools in parallel. One of them needed another one's answer.
Kartik N V J K
Kartik N V J K

Posted on Originally published at futureagi.com

I let my agent call its tools in parallel. One of them needed another one's answer.

I wanted my support agent to feel faster, so I stopped making it wait on itself. The job was small. Look up a customer's account, pull their recent orders, and write a short summary for the support team.

The model could request both tool calls in one turn, and my harness ran them side by side. Latency dropped. Then a summary came back describing orders that belonged to a different customer.

Nothing had failed. Both tools returned a normal result. The order lookup needed the account ID, and the account ID only existed after the first call finished. The model had asked for both calls in the same turn, so it filled the order lookup with a search on the customer's name. The search matched someone else, and the summary was written on top of that.

This is what I check now before I let tool calls run in parallel.

Parallel tool calls are something you switch off, not on

On Anthropic's API, parallel tool use is on by default. You turn it off with disable_parallel_tool_use: true inside tool_choice, which allows at most one tool call per response.

On OpenAI's API, the model may call several functions in one turn. Setting parallel_tool_calls to false limits it to zero or one call.

Google's Gemini docs describe two modes: parallel function calling for independent calls, and compositional function calling for calls that have to run in order.

None of these settings know which of your tools depends on another.

A parallel call cannot see the result it depends on

When the model asks for two calls in one turn, it writes the arguments for both before either one runs. If the second call needs a value from the first, there is nothing real to put there.

The model does not always stop. It can fill the gap with something that looks plausible from the conversation.

That is what makes this hard to spot. The tool gets a well-formed argument and returns a well-formed answer. It is just the answer to the wrong question.

A benchmark caught a model doing the same thing

TPS-Bench (ACL 2026) tests agents on tasks that need many tools spread across MCP servers. On its hard set, GLM-4.5 made extensive sequential calls and completed 64.72% of tasks, at an average of 217.8 seconds per task. GPT-4o leaned on parallel calls, averaged 76.84 seconds, and completed 45.08%.

The authors also describe QwQ-32B, which "often invokes multiple tools simultaneously, even when certain tools rely on the outputs of others". It completed 29.36%.

These are different models, so the numbers do not prove that sequential calls cause better results. What I take from them is narrower. How a model schedules tool calls is a behavior of that model, it varies, and the model will not always notice a dependency for you.

I sort each task's tools into independent and dependent

For every task, I now write down which calls can run together and which need an earlier result. Fetching an account and fetching the product catalog do not depend on each other, so they can run in parallel. Anything that takes an ID, a key or a filter from another tool runs after that tool.

Where the API cannot express that, I turn parallel calls off for that step.

I also made the dependent tool harder to fool. The order lookup now accepts only an account ID in the format our system issues. A customer name fails loudly instead of quietly matching the wrong person.

When a dependent chain gets long, I split it into smaller sub-chains. Every split point is a boundary, and it gets the same checks as a tool output.

Every parallel result gets checked before the merge

Parallel branches meet somewhere, usually in the step that writes the answer. That merge is where a bad branch turns into a confident summary.

So each result is checked on its own before the merge. It has to match the expected schema, every required field has to be present, and the account ID inside the order result has to match the account ID the account lookup returned. In my case that last check alone would have caught the wrong customer.

The worst version of this bug is when a tool returns an incomplete result and the model fills the holes. Check for nulls and empty fields, and tell the agent to stop and report what is missing instead of guessing.

A run that stops and says it could not find the account ID is annoying, but it costs far less than a polished summary of someone else's orders.

One wrong input travels further than it looks

A September 2025 study of more than 500 failed agent trajectories named error propagation the primary bottleneck in agent reliability. Its most common sources were memory and reflection errors, not tool scheduling. The pattern is still the one I hit: an early mistake that every later step builds on without question.

A guessed argument in step one is that early mistake. By the last step it reads like a fact.

What I would tell myself before turning on parallel tool calls

  • Know your default: check whether your API runs tool calls in parallel before you assume it does not.
  • Map dependencies per task: independent lookups run together, anything that needs another tool's output runs after it.
  • Make dependent tools reject guesses: validate the format of IDs and keys at the tool boundary.
  • Check before the merge: schema, required fields, and a matching ID on every branch.
  • Stop on missing data: a reported gap is cheaper than a filled one.

The longer version, with the other ways a tool chain fails and how to trace each step back to the first bad one, is in this piece.

Which of your tool calls turned out to depend on another one? For me it was the order lookup, because the dependency was a single ID and it looked too small to matter.

Top comments (4)

Collapse
 
princejain756 profile image
Prince Jain •

The other place parallel tool calls quietly break is inside the streaming parser before your merge check even sees the arguments.

I lost a few hours to two bugs like this in provider SDKs. In Agno's HuggingFace streaming path, chunks with multiple tool calls only read index 0, so the second call in a parallel turn vanished silently. In Vercel AI SDK's StreamingToolCallTracker, dropping a blank-name opener without recording its index let trailing argument deltas bleed into another active call in the same batch.

On your question, read-before-edit in coding agents tripped me up worst. Across 153 of my Claude Code and Codex logs, 39.0% of new functions were written without searching the repo first, and parallel search plus edit turns often guessed stale paths. Building on @mickyarun's point, tracking a per-run set of IDs or paths returned by prior tool outputs and rejecting any dependent call referencing something outside that set caught far more mistakes than format checks.

Are you gating that split in your tool executor, or flipping parallel_tool_calls off per step?

Collapse
 
mickyarun profile image
arun rajkumar •

The sentence doing the work here is "a parallel call cannot see the result it depends on". I would push on the fix rather than the diagnosis.

"Validate the format of IDs and keys at the tool boundary" catches malformed, not wrong. In your incident the name search returned a real account that was well formed and belonged to somebody else. A format check passes that cleanly, so does a schema check, so does a required-fields check. The only one of your five that would have caught it is the matching-ID check at the merge, and that one fires after both calls have already run.

What payments does instead is remove the fallback. The second leg of a payment does not accept a payer name. It accepts the id the first leg minted, that id is opaque, and the server checks that the two belong to the same session rather than checking the id looks valid. There is no name-shaped field to guess into, so nothing can route around the dependency even when it is trying to go faster.

Carried over to your case: the order lookup probably should not have a by-customer-name path at all. If it has to, that path belongs in a separate tool with a different name, so the model reaching for it is a visible choice rather than a silent substitution. The guess was only available because there was somewhere for it to go.

Where that stops working: sometimes name lookup is the legitimate entry point, and then you are back to needing the merge check. I do not think there is a way out of that, but it shrinks the surface to the tools where a name genuinely is the first step.

Collapse
 
mudassirworks profile image
Mudassir Khan •

the account ID inside the order result matching the account ID from the lookup is the check i would steal first. cheap, and it catches the exact wrong customer failure you hit.

we had the same shape on a billing agent. the model guessed an invoice ref in the same turn as the customer fetch and a plausible one came back. what fixed it was typed IDs, so the second tool rejects anything not in the issued format before it touches the database.

do you ever let a dependent chain run in one turn when every tool is read only, or is it sequential everywhere now?

Collapse
 
paul_irolla_6b5ae261d0224 profile image
Paul Irolla •

Parallel calls also cut the number of model turns, and each turn resends the context, so batching the independent ones saves more than wall-clock time. Did the retry hit only the failed call?