Confidence routing
Most systems use one axis: the label. Confidence routing adds a second axis: how sure the model is. The label says what to do. The confidence says who does it.
One router function covers every capability. Write it once, then reuse it per action with different numbers.
The four bands
The bands run in order and the first match wins. The numbers above are starting points, not measurements. Thresholds and confidence routing explains why a threshold belongs to the action. Tuning thresholds turns a golden set into your own numbers. This page is the code.
Act and confirm both apply the decision. The difference is reversibility. Confirm needs an undo path in your product. Without one, fold confirm into review.
Which field to route on
confidence is 1 − normalized entropy over the scores. It is 1 for one clear winner and 0 for a flat
distribution. Only classify and rate return it.
A low confidence means the scores spread across several options. Gate on both fields. Without the
confidence gate, a near tie reaches the act band.
Real responses, three bands
One classify call over three texts. The response below is real.
Result 1 and result 3 land in act. Result 2 does not. Its text says only "Can someone look at this? It has been going on for a while now." The winner account scores 0.632, and billing follows at 0.364.
The confidence of 0.378 reports that spread. Route this result to escalate and ask the customer one
question.
The router
Make the call, then apply the bands to each result. The call itself carries no thresholds.
No API key is required during the launch period.
Route a rate call on score
rate returns level as an argmax. It can flip on 0.001, as this real response shows.
Route on score and gate with confidence. score moves smoothly from 0 to len(scale) - 1, so pick
the cut-off on that range. The call is the same rate request shown on Rate. Only
the router changes. Here act means the quiet path, with no escalation.
Keep the bands honest
Store probability, confidence and the chosen band with every decision. You cannot tune without that
record. Watch the escalate share in Monitoring: a rise means the inputs changed.
Move one number at a time. Raise act when a wrong auto-action costs more. Lower review when the
queue grows faster than people clear it.
Batch the call, not the routing. One request carries up to 32 texts in texts[], and the results come
back in input order. Apply the bands in your own loop.