A large score can still be wrong
A router sends most database requests to one specialist. That frequency may reflect real suitability, or simply a previous coordinator always choosing the same role. The score measures the table that was constructed. It is not automatically a calibrated probability of correctness. Compare score ranges with independently reviewed outcomes on data that did not fit the table before labeling the score a trustworthy confidence estimate.
Measure the requests answered directly
A selective router can abstain and use a coordinator. Coverage is the fraction routed directly; selective error is the fraction of those direct routes that are wrong. Both matter. Raising a threshold usually reduces coverage, but accuracy need not improve monotonically on a finite sample. Report counts alongside percentages, especially for rare or sensitive tasks. Perfect accuracy on three direct routes is weak evidence for a broad deployment.
State the cost of mistakes
A wrong documentation route may waste a turn. A wrong route involving sensitive records can be more consequential. The example assigns ten units to an incorrect direct route and one unit to an abstention. These are synthetic decision costs, not provider prices. Under those assumptions a conservative threshold can be preferable despite lower coverage. Changing the objective can change which threshold is preferable; there is no universal best number.
Avoid tuning against the final evaluation
Use development data to propose thresholds, validation data to compare them and a separate final evaluation when practical. Keep related task families within one split. If repeated inspection of final failures guides threshold changes, that dataset has become development data. Record that transition honestly. The next release should include fresh evaluation evidence rather than reusing an increasingly familiar exam and calling it untouched.
Treat thresholds as versioned policy
A threshold change can send more work to a privileged role even when model weights remain unchanged. Store the threshold, classifier version, count-table revision and evaluation evidence together. Monitor fallback rate and category-specific mistakes after activation. Increased abstention may indicate vocabulary drift, missing context or a changed upstream classifier. Automatically lowering the threshold to hide the signal can convert uncertainty into incorrect routing.
Evaluate uncertainty in small categories
A category with few observations can show dramatic metric changes from a single mistake. Preserve sample sizes and avoid claiming stable improvement from one trial. In a larger evaluation, estimate uncertainty using methods appropriate to the sampling design, and inspect high-impact cases directly. Threshold selection should balance reviewed risk and workload objectives. It should not optimize a dashboard badge while quietly moving hard cases out of the measured population.
Run the exercise
Save the code as 09-confidence-and-abstention.py and run python 09-confidence-and-abstention.py with Python 3.11 or newer. This standard-library exercise uses synthetic data. It does not invoke a model or require an account, network connection or API key.
# Author: Sandeep Belgavi. Synthetic exercise; no network or provider calls.
cases=[(0.95,True),(0.80,False),(0.70,True),(0.55,False)]
def evaluate(threshold):
routed=[ok for score,ok in cases if score>=threshold]
wrong=sum(not ok for ok in routed)
return len(routed)/len(cases),wrong*10+len(cases)-len(routed)
assert evaluate(0.65)==(0.75,11)
assert evaluate(0.90)==(0.25,3)
print("threshold 0.90 costs 3 units; threshold 0.65 costs 11 units")
Expected output:
threshold 0.90 costs 3 units; threshold 0.65 costs 11 unitsChange one assumption
Replace the wrong-route cost with one unit and recalculate the tradeoff. Explain why the business objective must be stated before selecting the threshold. Add a fifth case in a rare category and observe how much one label changes the apparent result. This tiny fixture demonstrates arithmetic, not statistical proof.
Implementation scope and further reading
This is an original AICassindra teaching design. The exercise demonstrates the stated invariant; it is not a complete production implementation. The local Harness Studio extension supports saved read-only agent teams, reviewed count-based routing and bounded sequential execution. Arbitrary imported graphs, effectful tools and automatic self-promotion remain unsupported.
All harness articles · Interactive boundary labs · Our public lab code