Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →

Q30IntermediateConcept

When is it safe to run tool calls in parallel?

30-second answerSay your answer out loud first, then reveal.

Safe: "get weather for 3 cities", "search 4 documentation sites", "fetch profile + orders + tickets for one customer."

Unsafe or needs care

  • Dependencies: create_user then assign_role(user_id). The second needs the first's output.
  • Conflicting writes: two edits to the same file or record. Race conditions or lost updates.
  • Ordering semantics: "debit account A, credit account B" should be one transaction, not two parallel calls.
  • Rate limits: 20 parallel calls can trigger 429s.

Executor design

  • Tag tools as read_only vs mutating. Run read-only calls in parallel; serialise mutating calls, or lock per resource.
  • Bound concurrency (semaphores) and handle partial failures: 3 of 4 calls succeed → return all results with clear errors for the failed one.
  • Return results in a deterministic order, matched by call IDs.

Bonus: parallel sub-agents follow the same rule. Split work along independent lines, e.g. different research topics, not different parts of the same function.

Every expert started right here.