Ask for a label, not a paragraph: confidence-gated decisions in agent pipelines
Many of the model calls in a production agent are not writing anything. They are choosing: which queue, which intent, ship or hold. We treat those calls as typed judgments with a closed set of answers, a confidence score we actually check, and three bands that decide whether the agent acts, asks, or hands off.
We build production GenAI for operations, knowledge, and data. When we trace a working agent call by call, a pattern shows up every time. Only some of the calls write something a person will read. The rest are decisions. Is this email a refund request or a shipping question? Does this document belong to the finance tree or the legal tree? Is this draft ready for review, or does it go back for another pass?
Those decision calls are where quiet failures live. Nobody reads them. They just steer everything after them.
The prompt-and-parse trap
The first version of a routing step usually looks the same. A prompt asks a chat model to "classify this ticket and explain your reasoning," then a few lines of code hunt through the reply for a category name. It works in the demo. Then the model starts a reply with "Based on the details, this looks most like a billing issue, though it could also be account access," and the parser picks whichever word it finds first.
Three things go wrong at once in that setup.
The answer space is open. The model can invent a category you never defined, or blend two. The parser then guesses, and the guess is invisible.
There is no usable confidence. A paragraph that says "most likely" carries no number you can threshold. Asking the model to append "confidence: 0.9" gets you a number that sounds precise and usually is not tied to how often it is right.
And the cost is in the wrong place. You pay a writing model to write prose that a few lines of code then throw away.
A decision is a typed question
We now write those steps as typed questions instead. Each one has three parts.
The state. The text being judged, plus only the context the decision needs. A ticket body and the customer's plan tier. Not the whole conversation history.
A closed set of answers. A fixed list of options, a yes or no, or a score on a defined scale. Every option has a one-line definition the team agreed on. "Other" is allowed, and it is a real answer that routes somewhere, not a shrug.
A probability per answer. The step returns a distribution over the options, not a sentence. Structured output from a general model, logprobs read off an open model, a small fine-tuned classifier, or a dedicated decision model can all fill this slot. The interface stays the same, so the harness does not care which engine sits behind it.
That last point matters more than it looks. Once the decision has a type, swapping the engine becomes a routing change with tests, the same way we treat any model that has to earn its route. The prose-writing model keeps the jobs that need prose and multi-step reasoning. The judgment step does one thing.
A schema alone does not finish the job, though. Schema-constrained output guarantees the answer is one of your options. It says nothing about whether it is the right one, or how sure the system should be. That is the part most pipelines skip.
Confidence you have checked
A confidence score is only useful if it means what it says. If a step reports 0.9 on a batch of items, roughly nine in ten of those should be right. That property is called calibration, and it is separate from accuracy. A step can be accurate and badly calibrated, confidently wrong on exactly the cases you most need flagged.
So before any threshold goes live, we build a small labeled set from real traffic. Not synthetic examples. Real tickets, real documents, real drafts, each one labeled by the person who owns that lane. A few dozen rows per option is enough to see the shape. We run the decision step over the set, bucket the predictions by reported confidence, and compare each bucket's reported confidence with how often it was actually right.
That comparison is a reliability chart. A well-calibrated step tracks the diagonal. An overconfident one bows below it: it says 0.9 and lands well short of nine in ten. The chart tells us two things at once. Whether the raw scores are usable at all, and where the thresholds should sit.
Three bands, not one cutoff
A single cutoff forces a bad trade. Set it high and almost everything lands on a person's desk. Set it low and the agent acts on guesses. Two thresholds fix that by giving the middle a job.
Act. Above the high bar, the agent takes the step itself. We only allow this band for reversible, internal moves: routing a ticket, tagging a document, filing a draft into the right folder. Anything that leaves the building still goes through the approval gate, no matter how confident the score.
Ask. Between the bars, the agent prepares the action and shows it with the top two options. A person confirms with one click or picks the other one. This band is where most of the learning comes from, because every correction is a labeled example of exactly the kind the step finds hard.
Hand off. Below the low bar, or whenever the answer is "Other," the item goes to a human queue with the state attached, so the person does not start from zero.
Where the bars sit is a business decision written down in numbers, the same instinct as our numeric quality gates. The owner of the lane picks the error rate they can live with in the act band. The labeled set shows which confidence level delivers it. If no level does, the act band stays empty and the step runs in ask mode until it earns more.
The labels you already have
Here is the part we think most decision pipelines leave on the table. A routing step is one of the few model calls that sees its own outcome. The ticket was reopened or it was not. The reviewer moved the document to another folder or left it. The draft was approved or sent back.
Those are free labels, arriving every day. We log every decision with its state, its distribution, the band it landed in, and what happened next. On a schedule, a short job rebuilds the reliability chart from the last window of outcomes and compares it to the one that set the thresholds.
When the curve drifts (new product names, a new kind of request, a model update behind the engine), the check fails loudly before the act band starts quietly misrouting. Then a person looks at the new failures, adds them to the labeled set, and resets the bars. The same discipline we use when we delete one rule and rerun on an agent's instructions: change one thing, measure, keep only what holds.
Where we do not use it
Typed judgments are narrow on purpose. A single pass over a closed list cannot look anything up, run a check, or ask a follow-up question. So we keep them away from decisions that need any of that. Whether a contract clause is acceptable is not a label. Neither is anything involving a person's job, credit, or health; those stay with people, and a score can at most sort the queue they see.
We also do not trust a vendor's speed or accuracy multiple as a substitute for our own labeled set. A fast, cheap judge is useful. It is useful because we checked it on our traffic, not because a chart on a launch page said so.
What we have not settled is how small the labeled set can be for a lane with many rare options. A few dozen rows per option is easy for the common ones and slow for the long tail. For now the rare options live in the ask band until enough real corrections pile up. That is honest, but it is not fast.
The short version
Most of what an agent does is choose, not write. Give those choices a type: a defined state, a closed list of answers, and a probability per answer. Check that the probability means what it says on labeled data from real traffic. Split the work into act, ask, and hand off with two bars the lane owner signs off on. Then let the outcomes you already collect keep the bars honest.
Ask for a label. Check the confidence. Let the middle band teach you.