Agents, MCP and skillsLoading progress…

Orchestration and tracing

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

Orchestration and tracing

The orchestrator coordinates the workers: it assigns tasks, respects dependencies and integrates results. To diagnose a slow or failed run, record each worker and tool call as a span with the trace id, its own id and its parent's id. Then latency, cost and failures can be attributed to the part of the workflow that caused them: here worker-2 took 85 of the workflow's 100 ms, and the search tool inside it took 50.

workflow (100 ms)worker-1 (55 ms)worker-2 (85 ms)tool: search (50 ms)
s1 workflow parent=- s2 worker-1 parent=s1 s3 worker-2 parent=s1 s4 tool: search parent=s3

Every worker and tool call is a span carrying the trace id, its own id and its parent's id. That is how latency, cost and failures are traced back to the parent workflow. Without the parent ids, the spans are just an unordered list.

Add a span whose parent is missing.

Predict first. What links an agent tool span to its parent workflow?

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.