Real-Time Intent Routing in Voice Agents: How Jev Eliminates Turn Latency

Real-Time Intent Routing in Voice Agents: How Jev Eliminates Turn Latency

A caller phones a clinic line and says, "Hi, I need to move my appointment from Thursday." The agent answers after a beat of silence. The beat is not long, maybe three-quarters of a second, but the caller has already said "Hello?" into the void. Now both sides are talking over each other, the speech recogniser hears the overlap as a new utterance, and the agent confidently replies to a sentence that was never fully said. Nothing in the language model was wrong. The conversation broke because the pipeline around it spent its time budget on the wrong things.

Voice is the least forgiving interface we build for software. In human conversation the gap between one speaker finishing and the next starting is typically on the order of a couple of hundred milliseconds, and listeners notice when it stretches past a second. A chat UI can show a spinner for three seconds and nobody minds. A phone line cannot. This article looks at one specific piece of that budget, the step where the agent decides what the caller just meant, and explains why moving that decision out of a free-form language model call and into a small, typed judgment is one of the cheapest ways to win time back.

1. Where the time goes in a single voice turn

A voice turn is a relay race with at least five runners, and the audience hears the sum of their times. The first is endpointing: the system must decide that the caller has stopped talking, which usually means waiting for a stretch of silence long enough to be confident. The second is speech recognition finalising the transcript. The third is the decision about what to do: which tool to call, which flow to enter, whether to hand off to a person. The fourth is generating the reply text. The fifth is text-to-speech producing the first audible chunk, plus network transport back to the phone.

Streaming helps with several of these. Recognisers emit interim transcripts while the caller is still speaking, language models stream tokens, and synthesisers can start speaking after the first sentence. What streaming cannot remove is anything that must finish before the next stage can begin. Endpointing delay and the time to the first generated token sit squarely on the critical path of every turn. The routing decision also sits there when it is implemented as a full model call that has to read a long system prompt and produce a structured answer before the real reply can even start.

Stage of the turn What it waits for Can it overlap with the next stage? Main lever
Endpointing Enough silence, or a semantic signal that the sentence is complete Partly, by acting on interim text speculatively Tune silence thresholds, use semantic end-of-turn cues
Transcript finalisation The recogniser committing the last words Yes, downstream work can start on interim text Streaming recognition, domain vocabulary
Intent and route decision A model call that returns a decision Yes, questions can run in parallel and on partial text Bounded judgments instead of free-form generation
Reply generation Time to the first useful tokens Yes, tokens stream Smaller prompt, right-sized model, prefix caching
Speech synthesis and transport First audio chunk reaching the caller Yes, sentence-level streaming Streaming TTS, regional placement, codec choice

The table is qualitative on purpose. Real numbers depend on your recogniser, your model, your region and your telephony carrier, so measure each stage on your own traffic before arguing about which one to optimise. The pattern that holds across deployments is that the route decision is the stage with the most slack relative to the work it actually does.

2. Why "ask the big model what the caller wants" is the wrong first hop

The default design in many voice agents is a single large prompt: describe the persona, list the tools, paste the conversation, and let one model both decide and respond. It works in a demo. In production it couples three jobs with very different costs. Deciding which of six intents the caller expressed is a small classification problem. Extracting the date they mentioned is a small extraction problem. Writing a warm, correct sentence in reply is the genuinely generative part. Paying generative latency for the first two is waste.

There is a second cost that does not show up in a latency chart: the decision is entangled with the reply. When the model's routing choice and its spoken answer come out of the same generation, you cannot test the routing separately, you cannot cap its confidence separately, and you cannot run it earlier than the reply. A wrong tool call looks like a wrong sentence, and you debug both at once.

Splitting the first hop out gives each piece a contract. The router returns one of a closed set of options and a measure of how sure it is. The extractor returns typed fields or nothing. The reply generator gets the already-decided route and speaks. The router can be fast because its output is a few symbols, not paragraphs, and because it can be a smaller model purpose-built for judgment rather than the general model you use for conversation.

3. Three bounded judgments that cover most routing

System One style judgment models, of which Jev from TypeSafe is one example, expose a small vocabulary of question types. Each returns a typed result and a distribution, not free text, and code owns the workflow around them. Three primitives cover most of what a voice agent needs at the routing layer.

  • Choice picks one option from a closed set. Use it for "which of these flows does the caller want": reschedule, cancel, billing question, speak to a person, something else. The distribution over options tells you whether the winner was clear or a near tie.
  • Noul answers a yes/no condition as a probability. Use it for independent flags that can all be true at once: "is the caller asking for a human", "did they mention an emergency", "are they confirming what was just offered". One question per flag, because flags are not mutually exclusive and forcing them into a Choice hides combinations.
  • Score places the input on an ordered scale you describe, such as caller frustration from calm to angry. Use it where you need a degree, not a category, and combine several scores in code with your own weights.

Two properties make these suited to a latency-sensitive path. The output is tiny, so the cost of producing it is dominated by reading the input rather than writing the answer. And independent questions over the same state can be asked in one request and answered in parallel, so adding a fourth flag costs little wall-clock time compared with a second sequential round trip. Check the vendor's current documentation for exact request shapes and limits, since those evolve.

Typed output guarantees the interface, not the truth. A judgment model will always hand back one of your options with a probability. Whether that option is correct on your callers, with your accents and your noisy lines, is something you must measure on labelled examples from your own domain before trusting any threshold.

4. A worked example: routing a clinic call

Take the opening scenario. The state we hand the judgment layer is everything the decision needs and nothing it does not: the latest utterance, the previous assistant prompt, and a few facts the code already knows, such as whether the caller has an upcoming appointment on file. The model should never have to guess what the code can look up.

The sketch below defines a minimal client interface so the example stands alone. It is an illustration of the shape, not any vendor's SDK, so map it onto the real client you use.

// Illustrative shapes: adapt to the judgment client you actually use.
type Dist<T extends string> = Record<T, number>; // probabilities summing to ~1

interface JudgmentClient {
  choice<T extends string>(q: {
    state: string; question: string; options: readonly T[]; signal?: AbortSignal;
  }): Promise<Dist<T>>;
  noul(q: { state: string; question: string; signal?: AbortSignal }): Promise<number>; // P(yes)
  score(q: { state: string; question: string; levels: readonly string[]; signal?: AbortSignal }): Promise<number>; // 0..1
}

const INTENTS = ["reschedule", "cancel", "billing", "human", "other"] as const;
type Intent = (typeof INTENTS)[number];

type Route =
  | { kind: "flow"; intent: Intent; why: "confident" }
  | { kind: "clarify"; candidates: Intent[] }
  | { kind: "human" }
  | { kind: "fallback" }; // let the general conversational model handle it

function top<T extends string>(d: Dist<T>): { label: T; p: number; margin: number } {
  const sorted = (Object.entries(d) as [T, number][]).sort((a, b) => b[1] - a[1]);
  return { label: sorted[0][0], p: sorted[0][1], margin: sorted[0][1] - (sorted[1]?.[1] ?? 0) };
}

export async function routeTurn(
  client: JudgmentClient,
  utterance: string,
  lastPrompt: string,
  hasUpcomingAppointment: boolean,
  budgetMs = 250,
): Promise<Route> {
  const state = [
    `Assistant just said: ${lastPrompt}`,
    `Caller said: ${utterance}`,
    `Caller has an upcoming appointment on file: ${hasUpcomingAppointment}`,
  ].join("\n");
  const signal = AbortSignal.timeout(budgetMs);

  try {
    // Independent questions over the same state run together, not one after another.
    const [intent, wantsHuman, frustration] = await Promise.all([
      client.choice({ state, signal, options: INTENTS,
        question: "Which request is the caller making right now?" }),
      client.noul({ state, signal,
        question: "Is the caller asking to speak to a person?" }),
      client.score({ state, signal, levels: ["calm", "annoyed", "angry"],
        question: "How frustrated does the caller sound?" }),
    ]);

    if (wantsHuman > 0.6 || frustration > 0.8) return { kind: "human" };

    const best = top(intent);
    if (best.p >= 0.8 && best.margin >= 0.4) return { kind: "flow", intent: best.label, why: "confident" };
    if (best.p >= 0.4) {
      const candidates = (Object.entries(intent) as [Intent, number][])
        .filter(([, p]) => p >= 0.2).map(([k]) => k);
      return { kind: "clarify", candidates };
    }
    return { kind: "fallback" };
  } catch {
    return { kind: "fallback" }; // timeout or error: never block the turn on the router
  }
}

Three decisions in that function carry the design. First, a hard deadline: if the router does not answer inside its budget, the turn falls back to the general conversational model instead of waiting. The router is an optimisation, so it must never become a new way for the call to hang. Second, the thresholds are numbers you would calibrate on labelled calls; the values above are placeholders, not recommendations. Third, the "clarify" branch turns uncertainty into a short question to the caller ("Do you want to move it or cancel it?") rather than a guess, which costs one turn but avoids acting on the wrong intent.

What the caller experiences

When the route is confident, the reschedule flow starts immediately: the reply generator receives the intent, the appointment record and a narrow prompt, so its context is small and its first tokens arrive sooner. When the caller is irritated and has asked for a person for the second time, the escalation does not depend on whether a large model happened to notice the tone. The behaviour is code, and code is testable.

5. Starting early: judging on interim transcripts

The biggest win available to a voice agent is not a faster model but starting the decision before the caller has finished. Streaming recognisers produce interim hypotheses. A routing call on "I need to move my appointment" can run while the caller is still saying "from Thursday to Friday morning". If the final transcript confirms the same route, the answer is already waiting when endpointing fires and the decision stage has effectively cost nothing.

This is speculation, and it comes with rules.

  1. Tag every speculative call with the turn and the transcript version it saw. When the final transcript arrives, compare. If the text only grew by trailing words, keep the result. If an earlier word changed, or the caller said "actually, cancel it" at the end, discard and re-ask.
  2. Never take a side effect on a speculative route. Speculation may warm up the right prompt, prefetch the appointment record or prepare a tool call. It must not send the cancellation. Side effects wait for the committed route.
  3. Bound the extra work. Re-asking on every interim update multiplies calls. Debounce, and only re-ask when the new text could plausibly change the answer, for example when a negation or a new noun phrase appears.
  4. Stay cheap. The reason speculation is affordable here is that each judgment is small. Speculating with a full generation call on every partial transcript is a bill you will notice.

Barge-in is a routing problem too

When the caller interrupts the agent mid-sentence, the system has to decide whether the interruption is a real turn, a backchannel such as "mm-hm", or noise. A Noul question over the interrupting fragment ("is this a substantive interruption rather than an acknowledgement") is a natural fit: a fast yes/no with a probability, used to decide whether to stop speaking. Treat the cost of a false stop and a false continue separately. Cutting yourself off for a cough is annoying; talking over someone who is correcting you is worse.

6. Failure modes specific to voice routing

Voice adds failure modes that text routing never sees. Knowing them in advance is most of the defence.

  • Recogniser errors upstream. A router can only judge the text it receives. "Cancel" misheard as "cancel it" is harmless; "can't sell" is not. Feed the router the confidence information your recogniser exposes where available, and treat low-confidence transcripts as a reason to clarify rather than act.
  • Confidence misread as permission. Confidence describes how peaked one answer's distribution is. It is not a statement about the correctness of the whole workflow, and a confident wrong answer is still wrong. Keep irreversible actions, such as cancelling or paying, behind an explicit confirmation turn regardless of confidence.
  • Option sets that overlap. If "billing" and "cancel" both plausibly describe "I want to stop being charged", the distribution will split and your clarify branch will fire constantly. Fix the option definitions, not the threshold.
  • State that leaks the answer or hides it. If the last assistant prompt is omitted, "yes" has no referent. If you include a long history, you reintroduce the latency you were trying to remove. Include the last turn or two and the specific facts the decision depends on.
  • Drift after prompt or product changes. New flows silently change what correct routing means. Keep a set of labelled real utterances and re-run it whenever the option list or question wording changes.
  • The router as a single point of failure. Hence the deadline and the fallback path. The call must survive the router being slow, wrong or down.

7. When not to use a judgment model for routing

This pattern earns its place when the decision is genuinely linguistic, the option set is closed, and latency matters. It is the wrong tool in several cases.

  • The input is already structured. A DTMF keypress, a button in a companion app or a known account flag needs an if statement, not a model.
  • A handful of fixed phrases covers the traffic. A grammar or keyword match for "yes", "no", "repeat that" is faster, cheaper and fully predictable. Add a model only for the long tail.
  • The task is open-ended. If the caller can ask for anything and there is no closed set to route to, the general conversational model is the right first hop and forcing a Choice will only manufacture wrong answers.
  • You have no way to evaluate it. Without labelled examples of real calls, thresholds are guesses and you cannot tell a regression from noise. Collect a modest labelled set first.
  • Regulatory or safety decisions. A routing judgment may help decide where a call goes, but a decision with legal or safety weight needs deterministic rules and human review around it.
Routing approach Handles paraphrase Output contract Latency profile Typical failure
Keyword or regex rules Poorly Exact and deterministic Negligible Silent misses on phrasing you did not anticipate
Embedding similarity to examples Reasonably Nearest label, weak calibration Small, depends on index Confidently picks the nearest wrong neighbour
Free-form LLM routing in the main prompt Well Text you must parse Largest, on the critical path Malformed output, entangled with the reply
Bounded judgment model (Choice, Noul, Score) Well Typed result with a distribution Small, questions run in parallel Confident errors on out-of-domain input

The qualitative ordering is stable even though absolute numbers vary by deployment. A sensible production design often uses more than one row: rules for the obvious phrases, a bounded judgment for the paraphrase-heavy middle, and the general model for everything that falls out of the closed set.

8. Decision checklist and common mistakes

Before putting a judgment-based router on a live line, walk through this list.

  1. Is the set of next actions closed, with each option defined well enough that two people would label the same utterance the same way?
  2. Does the router have a hard deadline and a defined fallback that keeps the call alive?
  3. Are the questions that are independent asked together, in one request?
  4. Are flags modelled as separate yes/no questions rather than crammed into one Choice?
  5. Do irreversible actions require explicit confirmation regardless of confidence?
  6. Is speculative work free of side effects, and tagged so stale answers are discarded?
  7. Do you have labelled real utterances, including noisy ones, and a script that scores the router against them after every change?
  8. Do you log the full distribution, not only the winner, so you can see near ties in production?

The mistakes that come up most often mirror that list. Teams copy a threshold from an example instead of calibrating on their own calls. They route on the final transcript only and then wonder why the pause is still long. They put the persona and tool descriptions into the judgment state, bloating every call. They forget that the same words mean different things at different points in a dialog, so the previous assistant prompt is missing from the state. And they treat the router's confidence as a licence to skip confirmation on actions that cannot be undone.

9. What to do on Monday

Start with measurement, not a rewrite. Timestamp the stages of a few hundred real turns: end of speech, final transcript, route decision, first reply token, first audio. Look at where the median and the slow tail sit. If the route decision is a visible slice, that is your opening.

Then pick the single highest-volume decision, usually "which flow", and replace only that with a bounded Choice behind a deadline and a fallback. Label a few hundred real utterances for it, including the ugly ones. Calibrate the confidence thresholds on that set, add the clarify branch, and ship it behind a flag so you can compare against the old path on live traffic. Only after that works is it worth adding Noul flags, Score dimensions, or interim-transcript speculation.

Short FAQ

Does this remove the large model from the call? No. The general model still writes the reply. What changes is that it starts with a decided route and a smaller prompt instead of deciding and speaking in one pass.

Can I run the same pattern on a self-hosted model? Yes. The idea is the question shape, a closed set or a probability with code owning the workflow, and it does not depend on one vendor. Whatever you run, evaluate it on your own calls.

How many options is too many for a Choice? When you cannot define each option crisply or the distribution routinely splits across several, split the decision in two: a coarse Choice first, then a second question scoped to the winner.

What should I log? The state that was sent, the full distribution, the route taken, the deadline outcome and the eventual human or downstream correction. That log is your labelled dataset for the next round of calibration.