Agent Orchestration Explained
← /learn · 07

Reliability

Success decays with every step; retries fix visible errors, a verifier catches silent ones. The closed forms beside seeded simulations and their confidence intervals.

Check yourself ↓ three questions and what to remember, at the end

Loading the animation…

Concept

Every step of a workflow can go wrong, and the failures multiply. If each step is right with probability pp, a chain of nn steps is right with probability pnp^n: at 92% a step (5% visible errors, 3% silent ones), ten steps succeed 43.4% of the time and thirty steps 8.2%. The animation runs 48 seeded workflows of ten steps, one step at a time; the chart beside it puts the closed form (lines) against 2,000 simulated runs at each length (dots, with 95% intervals).

Two kinds of failure need two different fixes:

  • A visible error (an exception, a malformed tool call, a timeout) can be retried. With three attempts a step fails only if all three do, and ten steps succeed 72.5% of the time (simulated: 72.9%). Retries cost little: 10.53 attempts per ten-step run on average.
  • A silent error (a plausible wrong answer) passes straight through retries, because nothing signals it. Only a verifier catches it: a second check (a test suite, a schema, a second model) that rejects a wrong result with probability dd (here 80%) and, its own cost, a right one with probability ff (5%). A rejection is retried like an error. With both, ten steps succeed 91.8% of the time (simulated: 92.5%) and thirty 77.3%, against 38.0% with retries alone.

The design rule that falls out: make failures visible wherever you can (validate outputs, run the tests, check the schema), because a visible failure costs one retry and a silent one costs the whole run. Retries are only as good as the error signal behind them.

Maths

One attempt at a step is a visible error with probability ee, silently wrong with probability ww, correct with c=1−e−wc = 1 - e - w. With a verifier of recall dd and false-rejection rate ff (both zero without one) an attempt is retried with probability r=e+cf+wdr = e + c f + w d, accepted correct with a=c(1−f)a = c(1-f), accepted wrong with b=w(1−d)b = w(1-d). With AA attempts, attempt j+1j+1 happens only if the first jj were all retried, so the step is correct with probability a (1+r+⋯+rA−1)=a SAa\,(1 + r + \dots + r^{A-1}) = a\,S_A, silently wrong with b SAb\,S_A, and gives up with rAr^A; it takes SAS_A attempts on average. A run of nn steps succeeds if every step is correct, (aSA)n(a S_A)^n; it stops early when a step gives up, so its expected attempts are SA∑i<n(1−rA)iS_A \sum_{i<n} (1 - r^A)^i.

At the defaults with three attempts and no verifier: r=0.05r = 0.05, S3=1.0525S_3 = 1.0525, a=0.92a = 0.92, so a step is right with probability 0.9680.968 and ten steps with 0.96810≈0.7250.968^{10} \approx 0.725. The 95% intervals are Wilson score intervals; the engine's tests require every simulated rate to be within four standard errors of its closed form, for twelve configurations of 6,000 runs each.

Code

One attempt, cut from the vendored engine's simulation (reliability.ts):

const u = r.random();
if (u < e) {
  log.push("error");
  continue;
}
const right = u >= e + w;
if (verifier) {
  const v = r.random();
  if (right && v < verifier.false_reject) {
    log.push("rejected_ok");
    continue;
  }
  if (!right && v < verifier.recall) {
    log.push("caught");
    continue;
  }
}

Check yourself

Commit to an answer before you reveal it: a wrong guess you can explain teaches more than a right one you skimmed. Every number in the answers comes from the same tested model as the chapter’s.

Q1Each step is right 92% of the time. How often does a ten-step chain succeed with no retries?
Reveal the answer

Answer: 43.4% (counted right within ± 5%)

0.92100.92^{10}: failures multiply. Thirty steps succeed only 8.2% of the time.

Failures multiply →

Commit to a number, then reveal.

Q2Now allow three attempts per step. How often does the ten-step chain succeed?
Reveal the answer

Answer: 72.5% (counted right within 10%)

Retries fix the visible errors, for about 10.53 attempts per run, but not the silent ones, which pass straight through.

Two kinds of failure →

Commit to a number, then reveal.

Q3What catches a silent error, a plausible wrong answer?
Reveal the answer

Answer: A verifier

A verifier: a test suite, a schema, a second model that rejects a wrong result. With retries and a verifier, ten steps succeed 91.8% of the time.

Two kinds of failure →

Pick one, then reveal.