Agent Orchestration Explained

/data

Conformance and results

Everything here is computed by the vendored engine when the site is built, from the engine at commit 46b445c; the engine's own recorded runs are orchestration_results.md (chapters 1–4) and orchestration2_results.md (chapters 5–9). Every token size, accuracy, rate limit, failure rate and timing in chapters 5–9 is illustrative.

LangGraph conformance

Recorded with langgraph 1.2.14 (langgraph-checkpoint 4.2.0, an in-memory checkpointer) by record_langgraph.py from graphs built by langgraph_graphs.py; the recording is langgraph_recordings.json. After every operation the full checkpoint history (step, source, parent, state, next tasks, each task's result, error and interrupts), the outcome, the node runs and the side effects are compared with the engine's; the engine's CI re-records them live on every change. 39 sessions, 71 operations, 232 checkpoints in the final histories.

sessiongraphoperationsoutcomescheckpoints
chainchaininvokedone5
fanoutfanoutinvokedone5
react_loopreact_loopinvokedone7
uneven_joinuneven_joininvokedone6
no_joinno_joininvokedone5
router_viewrouter_viewinvokedone3
merge_overwritemerge_overwriteinvokeerror (InvalidUpdateError)3
merge_addmerge_addinvokedone5
merge_maxmerge_maxinvokedone5
fanout_listfanout_listinvokedone4
start_routerstart_routerinvokedone3
approvalapprovalinvoke; resumeinterrupted; done5
approval_noapprovalinvoke; resumeinterrupted; done5
gatedgatedinvoke; continuepaused; done5
gated_editgatedinvoke; update 2 as planner; continuepaused; updated; done6
gated_aftergated_afterinvoke; continuepaused; done4
crashcrashinvoke (crash enrich); continueerror (NodeFailure); done5
crash_twicecrashinvoke (crash enrich); continue (crash enrich); continueerror (NodeFailure); error (NodeFailure); done5
counter_okcounterinvoke (limit 5)done6
counter_edgecounterinvoke (limit 5)recursion_limit7
counter_overcounterinvoke (limit 5); continue (limit 3); continue (limit 25)recursion_limit; done; done10
replaybranchyinvoke; replay 2done; done8
forkbranchyinvoke; update 2 as plan; continuedone; updated; done8
fork_other_nodebranchyinvoke; update 2 as search; continuedone; updated; done7
replay_updatebranchyinvoke; update 2 as plan; replay 5done; updated; done8
loop_joinloop_joininvokedone8
start_router_elsestart_routerinvokedone3
loop_join_crashloop_joininvoke; replay 3; update 5 as check; continuedone; done; updated; done14
after_updategated_afterinvoke; update 2 as a; continuepaused; updated; done5
replay_interruptgatedinvoke; continue; replay 2paused; done; done8
map_reducemap_reduceinvokedone5
map_reduce_crashmap_reduceinvoke (crash summarise); continueerror (NodeFailure); done5
map_reduce_replaymap_reduceinvoke; replay 2done; done8
map_reduce_updatemap_reduceinvoke; update 2 as split; continuedone; updated; done8
map_reduce_nonemap_reduceinvoke; update 2 as split; continuedone; updated; done6
map_reviewmap_reviewinvoke; resumeinterrupted; done5
send_mixedsend_mixedinvokedone5
map_loopmap_loopinvokedone8
map_emptymap_loopinvokedone4

Super-steps of chapter 1's graphs

Illustrative node durations and a 15 ms checkpoint write; the super-steps are LangGraph's (the bulk-synchronous model of Pregel, SIGMOD 2010).

graphsuper-stepsgraph timeone node at a timespeed-up
chain42.86 s2.86 s1.00×
fanout43.26 s4.47 s1.37×
react_loop63.59 s3.59 s1.00×
loop_join72.9 s3.94 s1.35×

Durable execution runs (chapter 4)

Every combination the widget offers: fault, idempotency key, and how the shipping choice is made. The history's shape follows durable-execution engines such as Temporal, simplified; every time is illustrative.

fault | key | choiceoutcomecharges£ chargedeventsfinished at
none | nokey | clockcompleted140101.8 s
none | nokey | markercompleted140111.8 s
none | key | clockcompleted140101.8 s
none | key | markercompleted140111.8 s
crash_after_charge | nokey | clockcompleted140106.81 s
crash_after_charge | nokey | markercompleted140116.81 s
crash_after_charge | key | clockcompleted140106.81 s
crash_after_charge | key | markercompleted140116.81 s
crash_in_charge | nokey | clockcompleted280107.61 s
crash_in_charge | nokey | markercompleted280117.61 s
crash_in_charge | key | clockcompleted140107.61 s
crash_in_charge | key | markercompleted140117.61 s
crash_in_ship | nokey | clocknondeterminism14066.61 s
crash_in_ship | nokey | markercompleted140117.31 s
crash_in_ship | key | clocknondeterminism14066.61 s
crash_in_ship | key | markercompleted140117.31 s
lost_reply | nokey | clockcompleted280114.6 s
lost_reply | nokey | markercompleted280124.6 s
lost_reply | key | clockcompleted140114.6 s
lost_reply | key | markercompleted140124.6 s

Lost replies and retries: simulation against closed form

Each charge attempt's reply lost with probability q, at most A attempts, every attempt reaching the service. Seeded (mulberry32), the same in Python and in the browser.

qAmean charges, no key(1 − q^A)/(1 − q)P(two or more)qP(all lost)q^Awith a key
0.0511.00001.00000.00000.00000.04880.05001.0000
0.0521.04911.05000.04910.05000.00230.00251.0000
0.0531.05141.05250.04920.05000.00010.00011.0000
0.0551.05151.05260.04910.05000.00000.00001.0000
0.111.00001.00000.00000.00000.09690.10001.0000
0.121.09701.10000.09690.10000.00970.01001.0000
0.131.10641.11000.09690.10000.00110.00101.0000
0.151.10761.11110.09680.10000.00000.00001.0000
0.211.00001.00000.00000.00000.19830.20001.0000
0.221.20011.20000.20010.20000.03990.04001.0000
0.231.24111.24000.20060.20000.00740.00801.0000
0.251.24941.24960.19990.20000.00060.00031.0000
0.311.00001.00000.00000.00000.29980.30001.0000
0.321.29951.30000.29950.30000.09030.09001.0000
0.331.39121.39000.30130.30000.02590.02701.0000
0.351.42471.42510.30050.30000.00270.00241.0000
0.511.00001.00000.00000.00000.49950.50001.0000
0.521.49701.50000.49700.50000.25240.25001.0000
0.531.75281.75000.49920.50000.12410.12501.0000
0.551.93871.93750.49780.50000.03210.03131.0000

20 settings of 20,000 orders each, seed 24.

Multi-agent patterns (chapter 5)

Uncontended (no queueing), Claude Sonnet 4.6 list prices, the hosted latency profile; accuracy falls 0.01 per 1,000 prompt tokens past 4,000 (illustrative). Sub-questions × tool-result tokens.

taskpatternmodel callsinput tokenscachedcostlatencyP(success)
4 × 700single512,7007,620$0.030914.8 s90.3%
4 × 700supervisor1319,6409,120$0.070434.6 s81.7%
4 × 700hierarchical1723,59010,350$0.090244.5 s77.7%
4 × 700swarm824,0409,480$0.08129.6 s84.0%
4 × 700debate1137,02016,500$0.1123.1 s90.2%
4 × 700map_reduce1014,4804,200$0.06815.9 s83.0%
4 × 1500single520,70012,420$0.044415.5 s85.7%
4 × 1500supervisor1322,8409,120$0.082435.3 s81.7%
4 × 1500hierarchical1726,79010,350$0.1045.2 s77.7%
4 × 1500swarm836,84014,280$0.1131.2 s76.4%
4 × 1500debate1161,02028,500$0.1624.2 s87.8%
4 × 1500map_reduce1017,6804,200$0.0816 s83.0%
8 × 700single936,54028,420$0.052223.2 s76.8%
8 × 700supervisor2543,22024,220$0.131 min 3 s68.1%
8 × 700hierarchical2943,57021,850$0.151 min 13 s64.8%
8 × 700swarm1682,32037,100$0.231 min 1 s54.4%
8 × 700debate1576,06043,380$0.1732.1 s78.6%
8 × 700map_reduce1826,9208,400$0.1219.1 s70.6%
8 × 1500single965,34050,820$0.082924.5 s58.3%
8 × 1500supervisor2549,62024,220$0.151 min 4 s68.1%
8 × 1500hierarchical2949,97021,850$0.171 min 14 s64.8%
8 × 1500swarm16133,52059,500$0.341 min 6 s32.6%
8 × 1500debate15136,86079,380$0.2834.5 s61.9%
8 × 1500map_reduce1833,3208,400$0.1519.2 s70.6%
16 × 700single17120,700106,500$0.1140.1 s37.6%
16 × 700supervisor49105,26069,300$0.251 min 59 s46.4%
16 × 700hierarchical5390,97052,290$0.262 min 9 s45.1%
16 × 700swarm32301,600143,700$0.732 min 13 s7.4%
16 × 700debate23190,620133,620$0.3050.1 s39.9%
16 × 700map_reduce3451,80016,800$0.2325.5 s50.6%
16 × 1500single17229,500202,500$0.1842.6 s11.2%
16 × 1500supervisor49118,06069,300$0.302 min 2 s46.4%
16 × 1500hierarchical53103,77052,290$0.312 min 12 s45.1%
16 × 1500swarm32506,400239,700$1.162 min 35 s0.7%
16 × 1500debate23363,420256,020$0.5255.1 s12.3%
16 × 1500map_reduce3464,60016,800$0.2825.6 s50.6%

Fan-out under a rate limit (chapter 6)

A map-reduce over 32 chunks of 2000 tokens, 50 requests and 8,000 output tokens a minute, simulated with no failures.

input tokens / minwidthrun timespeed-upAmdahlbucket bound
40,00012 min 21 s1.00×1.00×1.49×
40,00021 min 42 s1.38×1.88×1.49×
40,00041 min 42 s1.38×3.34×1.49×
40,00081 min 42 s1.38×5.49×1.49×
40,000161 min 42 s1.38×8.08×1.49×
40,000321 min 42 s1.38×10.58×1.49×
80,00012 min 21 s1.00×1.00×8.20×
80,00021 min 15 s1.88×1.88×8.20×
80,000442 s3.34×3.34×8.20×
80,000825.6 s5.49×5.49×8.20×
80,0001625.5 s5.50×8.08×8.20×
80,0003225.5 s5.50×10.58×8.20×
200,00012 min 21 s1.00×1.00×36.74×
200,00021 min 15 s1.88×1.88×36.74×
200,000442 s3.34×3.34×36.74×
200,000825.6 s5.49×5.49×36.74×
200,0001617.4 s8.08×8.08×36.74×
200,0003213.3 s10.58×10.58×36.74×

Reliability: closed form against simulation (chapter 7)

Visible errors 0.05, silent errors 0.03 per attempt; 2,000 seeded runs a point; 95% Wilson intervals.

each step getsstepsclosed formsimulated95% intervalattemptsclosed form
one attempt10.92000.92450.912–0.9351.001.00
one attempt20.84640.85800.842–0.8731.961.95
one attempt30.77870.75650.737–0.7752.842.85
one attempt50.65910.66100.640–0.6814.514.52
one attempt80.51320.49900.477–0.5216.746.73
one attempt100.43440.43800.416–0.4607.918.03
one attempt150.28630.29100.272–0.31110.9110.73
one attempt200.18870.17150.156–0.18912.6512.83
one attempt300.08200.09300.081–0.10716.1015.71
retries (3 attempts)10.96830.96750.959–0.9741.051.05
retries (3 attempts)20.93760.94350.933–0.9532.102.10
retries (3 attempts)30.90790.90350.890–0.9163.173.16
retries (3 attempts)50.85120.85450.838–0.8695.275.26
retries (3 attempts)80.77280.74950.730–0.7688.418.42
retries (3 attempts)100.72460.72900.709–0.74810.5310.52
retries (3 attempts)150.61680.59000.568–0.61115.7515.77
retries (3 attempts)200.52500.50550.484–0.52721.0721.03
retries (3 attempts)300.38050.40750.386–0.42931.4831.52
retries + verifier10.99150.99200.987–0.9951.131.13
retries + verifier20.98300.98750.982–0.9922.272.27
retries + verifier30.97460.97150.963–0.9783.403.40
retries + verifier50.95810.95450.944–0.9635.645.65
retries + verifier80.93370.93200.920–0.9429.049.02
retries + verifier100.91790.92450.912–0.93511.2511.26
retries + verifier150.87940.88050.866–0.89416.8416.81
retries + verifier200.84250.83650.820–0.85222.4222.32
retries + verifier300.77330.78250.764–0.80033.1833.19

Many workflows at once (chapter 8)

200 workflows per row, Poisson arrivals, seed 11; 50 requests, 40,000 input and 8,000 output tokens a minute, concurrency 16, transient failures 3% per attempt, up to 3 attempts.

patterncapacity / minarrivals / minsuccessp50p95p99$ per successcompleted / min
single7.87192.5%16.8 s19.4 s20.1 s$0.03340.99
single7.87292.5%17 s19.2 s20 s$0.03341.98
single7.87392.0%16.8 s19.5 s20.6 s$0.03362.95
single7.87492.5%16.6 s18.8 s20.2 s$0.03343.95
single7.87692.5%16.6 s19.1 s19.7 s$0.03345.91
single7.87887.5%1 min 33 s2 min 39 s2 min 58 s$0.03536.97
supervisor3.80181.0%39.6 s42.8 s44.5 s$0.08690.87
supervisor3.80278.5%39.9 s43.4 s45.2 s$0.08961.68
supervisor3.80380.5%40.5 s1 min 6 s1 min 15 s$0.0872.57
supervisor3.80485.0%7 min 58 s10 min 45 s11 min 27 s$0.08283.15
supervisor3.80683.5%27 min 22 s31 min 11 s32 min 47 s$0.08432.96
supervisor3.80883.5%35 min 11 s38 min 31 s40 min 38 s$0.08432.91
map_reduce3.89183.0%18.8 s22 s23.4 s$0.08190.89
map_reduce3.89283.5%18.9 s21.2 s22.9 s$0.0811.79
map_reduce3.89384.0%19.5 s53.1 s1 min 7 s$0.08082.70
map_reduce3.89483.5%4 min 40 s7 min 14 s8 min 9 s$0.08143.21
map_reduce3.89682.5%19 min 38 s27 min 45 s28 min 24 s$0.08243.13
map_reduce3.89881.5%29 min 46 s34 min 1 s36 min 59 s$0.08343.03
debate1.95190.5%28.1 s46.6 s56.5 s$0.130.97
debate1.95290.0%10 min 34 s15 min 12 s16 min 23 s$0.131.72
debate1.95390.0%36 min 19 s51 min 41 s55 min 44 s$0.131.71
debate1.95490.5%54 min 9 s67 min 37 s74 min 38 s$0.131.73
debate1.95692.0%73 min 38 s81 min 57 s83 min 38 s$0.121.74
debate1.95892.5%81 min 3 s88 min 4 s89 min 23 s$0.121.76

The chooser's tables (chapter 9)

1,000 simulated workflows per row, 1,500-token tool results; arrivals 1 a minute for 4 sub-questions and 0.25 for 16. The closed form is chapter 5's success times the chance every call gets through its retries.

sub-questionspatternsuccess (95% interval)closed formp95$ per successcapacity / min
4single85.0% (82.7%–87.1%)85.7%19.9 s$0.05224.83
4supervisor82.4% (79.9%–84.6%)81.7%44.8 s$0.09992.92
4hierarchical78.8% (76.2%–81.2%)77.7%57.2 s$0.132.43
4swarm76.9% (74.2%–79.4%)76.4%1 min 40 s$0.151.77
4debate87.3% (85.1%–89.2%)87.7%13 min 5 s$0.191.23
4map_reduce83.4% (81.0%–85.6%)82.9%22.5 s$0.09592.97
16single10.5% (8.7%–12.6%)11.2%51.7 s$1.741.48
16supervisor47.2% (44.1%–50.3%)46.4%3 min 12 s$0.630.82
16hierarchical45.2% (42.1%–48.3%)45.0%3 min 37 s$0.690.78
16swarm0.8% (0.4%–1.6%)0.7%3648 min 10 s$145.150.15
16debate13.1% (11.1%–15.3%)12.3%16 min 33 s$3.980.37
16map_reduce52.3% (49.2%–55.4%)50.5%2 min 32 s$0.530.84