The rule is deliberately blunt: the engine looks at the category of every call in the turn, and runs them in parallel only if all of them are read or task. One write in the batch and the whole turn goes sequential.
// Parallel: three reads in one turn
read { path: "a.md" } glob { pattern: "**/*.ts" } grep { pattern: "TODO" }
// Sequential: the write makes the whole turn sequential
read { path: "a.md" } write { path: "b.md", content: "…" }# The Python engine runs the calls of one turn in order, one after the other:
# read {"path": "a.md"} glob {"pattern": "**/*.ts"} grep {"pattern": "TODO"}
# A write in the same turn simply runs at its place in that order
# read {"path": "a.md"} write {"path": "b.md", "content": "…"}Why it is all-or-nothing
If two calls needing approval ran at once, the user would face two prompts for actions whose order is undefined — and approving one would mean approving a state that the other is concurrently changing. Running them in order makes each prompt describe a situation that is actually true.
It also keeps the failure story simple: in a sequential turn, a call that fails is followed by calls that can see it failed.
Subagents are where it pays
task is in the parallel set, so several subagents asked for in the same turn genuinely run at the same time, each with its own context. That is the one place where a long job gets meaningfully shorter.
// The model asks for three in one turn — all three run at once
task { agent: "explore", description: "Map the data layer" }
task { agent: "explore", description: "Map the API routes" }
task { agent: "explore", description: "Find every TODO older than a year" }# The model may ask for several subagents in one turn; Python runs them one after the other
# task {"agent": "explore", "description": "Map the data layer"}
# task {"agent": "explore", "description": "Map the API routes"}
# task {"agent": "explore", "description": "Find every TODO older than a year"}Their turns are added to the parent's usage as they happen, so the shared budget bites on all of them together. Their events reach your onEvent carrying parentId, and their identifiers are prefixed with the task's.
A sequential turn checks for stop between calls
Each call in a sequential batch is preceded by the stop check, so stop() takes effect within the turn. A parallel batch is already in flight and finishes.
The model is told to batch
The system prompt names the forms that exist — read { paths }, bash { commands }, independent tools in one turn — because a model does not produce them on its own. Each tool call costs a whole turn, so batching is the single biggest lever on what a run costs.