Agents, MCP and skillsLoading progress…

Parallel work

Choose when to delegate independent work and define handoffs, shared-state rules and evaluation.

Parallel work

Parallel execution helps when tasks have independent resources and outputs. It fails quietly when they do not: three workers rewriting the same line produce a conflict, and an external rate limit (2 concurrent requests) turns five "parallel" 4-minute tasks into 3 rounds, 12 minutes. Check which resources each task reads and writes before fanning out, and decide in advance how overlapping edits are merged.

worker 1 edits line10worker 2 edits line10worker 3 edits line10
conflicting lines: 10 → two or more workers changed the same line: a merge rule or a human is needed
independent tasks5external limit: concurrent requests2minutes per task4
5 tasks, 2 at a time → 3 round(s) × 4 min = 12 minutes (not 4)

Parallel work helps when tasks have independent resources and outputs. Shared files and external rate limits make apparently independent work collide or queue.

Move the workers onto the same line, then change the external limit.

Predict first. Does three workers editing one file automatically produce a useful merge?

Chapter context

Delegation can divide a task into focused work units, but coordination creates costs and new failure paths. Add helpers when their independent contributions can be integrated and checked more clearly than one agent can do the work alone.

Chapter reference: math, worked example & code

This section belongs to the whole chapter, so it is the same on every lesson in it and may cover a different lesson's topic. The code for the experiment you just ran is inside the experiment itself.

Math and notation

With independent parallel task durations t1,…,tnt_1,\ldots,t_n and merge time m, an ideal lower-bound schedule is max⁡iti+m\max_i t_i+m, excluding orchestration overhead. If independent tasks each succeed with probability p, all n succeed with probability pnp^n; correlated failures invalidate that simple model.

Worked example

Three tasks take 2,5 and 3 minutes; integration takes 1. Ideal sequential duration is 11 minutes, while fully independent parallel duration is 6. Separately, three independent 90%-reliable components all succeed with probability 0.9^3=0.729. The latency gain does not itself establish a reliability gain.

Reference code

The following example uses the Python standard library and does not call a remote service.

from math import isclose
times,merge=[2,5,3],1
assert sum(times)+merge == 11
assert max(times)+merge == 6
assert isclose(.9**3,.729)

Python examples are provided for study and local execution; this page does not execute Python.

Common mistakes

Parallel workers need explicit ownership of shared artifacts. Agreement can reflect correlated failure. More agents can increase token usage and integration work even when wall-clock time falls.