Skip to slide
Chapter 8 · Parallelism, the Responses API, and the App Server
49 / 142

CHAPTER 08 · Parallelism, the Responses API, and the App Server · 1 / 8

Parallel tool calls

Modern agent APIs support parallel_tool_calls: the model can request several tool executions in a single response. When that happens, the harness has decisions to make (per the "Inside the Agent Harness" analysis):

  1. Dependency analysis. Can these truly run at once, or does one depend on another's output? Reading two unrelated files is parallelizable; "create a directory then write a file into it" is not.
  2. Resource constraints. How many processes can you safely spawn at once?
  3. Approval batching. Ask the user to approve all of them together, or one at a time?

Codex collects the independent calls, runs them concurrently (it uses a FuturesOrdered collection in Rust to keep results in order), and sends all the outputs back to the model in a single follow-up request. There is also an important safety nuance from Chapter 5 and 6: read-only tools can run in parallel freely, but mutating tools should run sequentially to avoid race conditions (two edits to the same file at once is a recipe for corruption). Anthropic's harness follows the same rule: parallel reads, serial writes.

← → arrow keys work too