Course · Part 1, The loop · Lesson 1.3 · 12 min

Routing: the request sent to the wrong specialist

A one-word router with no way to say "unsure" sent a billing problem to the technical agent, which answered anyway.

Before you read: find the line

Read the run below once. Decide which line is the mistake. The lesson tells you.

Support router, three specialists, one word allowed
  1. 1systemrouter prompt: "Classify the message as billing, shipping or technical. Reply with one word."
  2. 2userThe app says my order failed but my card was charged $149. Now I can't log in either.
  3. 3llmroute -> "technical"
  4. 4llmtechnical agent (tools: reset_password, check_service_status) takes the message
  5. 5toolreset_password(email=customer) -> link sent
  6. 6llmreply -> "Sorry about that! I've sent a password reset link. Once you're back in, the order should show correctly."
  7. 7donestatus: success

What broke

A support system has a router in front of three specialist agents: billing, shipping and technical. Each specialist has its own tools and its own prompt. The router is one model call: "Classify the message as billing, shipping or technical. Reply with one word." A customer wrote: "The app says my order failed but my card was charged $149. Now I can't log in either." The router said technical. The technical agent sent a password reset link and told the customer the order would show correctly once they were back in. Status success.

The charge was never looked at. The customer is $149 down, has a reset link they did not ask for, and will write again. The run is seven lines.

Why it broke

Line 3 is where it shows. The message had two problems in it, a charge with no order and a login failure, and the router was only allowed one word. Three labels, no "unsure", no "both". So it picked. Routers tend to pick on the last sentence or the most concrete noun, and "can't log in" is concrete. The failure was built into the prompt at line 1: a classifier that cannot say "I do not know" will always say something.

Then the specialist made it worse. The technical agent had reset_password and check_service_status. It had no tool for charges and no instruction to hand back a message it could not handle. So it did what it could, reset the password, and wrote a sentence about the order that it had no way to check. A wrong route plus a specialist that never refuses is the common shape of this bug. Each half looks fine on its own.

Nobody saw it because nothing measured it. There was no label on the ticket saying what the right route was, so there was no routing accuracy number, so a misroute looked like a resolved ticket.

What a senior engineer does

Give the router a way out. The output is a small JSON object, not a word: route, confidence, and a second route when the message has two problems. Add an "unsure" value. Below a confidence you set from data, the ticket goes to a person, or to a general agent that can ask one clarifying question. Anthropic's 2024 guide on building effective agents describes routing this way: classify, then send to a specialized follow-up, and it works where the categories are distinct and the classification can be done accurately. A route is a decision with a failure mode, and the failure mode needs somewhere to go.

Make the handoff carry context and allow a return. In the OpenAI Agents SDK a handoff is a tool call that passes the conversation to another agent; the specialist should also have a tool to pass it back with a reason. The technical agent in this run should have said: this message has a charge in it and I have no tool for charges, route to billing. One sentence in its prompt, one extra tool.

Measure it. Label 200 real tickets by hand with the right route. Run the router over them every time the prompt or the model changes. Track two numbers in production: the misroute rate on the sample you spot check each week, and the share of tickets re-opened within seven days, because a re-opened ticket is often a misrouted one. Routing also decides cost. The RouteLLM paper (2024) showed that sending easy requests to a cheap model and hard ones to a strong one cut cost by more than half in some benchmarks while keeping quality close to the strong model alone. The design is the same: a confidence, a threshold, and a labelled set to tune it.

What to say in the interview

Line first. "Line 3. The router picked technical for a message that was about a charge and a login, because it was only allowed one word and had no unsure option. I would make it return a route and a confidence, add unsure, send low-confidence tickets to a person, and let the specialist hand back. Then I would label a few hundred tickets so the misroute rate is a number." If they ask what you would measure, name the two numbers and say why the second one matters: re-opens are where misroutes hide.

The line

Support router, three specialists, one word allowed
  1. 1systemrouter prompt: "Classify the message as billing, shipping or technical. Reply with one word."
  2. 2userThe app says my order failed but my card was charged $149. Now I can't log in either.
  3. 3llmroute -> "technical"
  4. 4llmtechnical agent (tools: reset_password, check_service_status) takes the message
  5. 5toolreset_password(email=customer) -> link sent
  6. 6llmreply -> "Sorry about that! I've sent a password reset link. Once you're back in, the order should show correctly."
  7. 7donestatus: success

Line 3. The router had three labels, no "unsure" and no way to name two routes, so a message about a charge and a login was forced into one word, and the last sentence won. The technical agent had no tool for charges and no way to hand back, so it solved the problem it could solve and talked past the one it could not. Nothing measured whether routes were right.

The pause

Two things in the fix stop this exact run from repeating. One is in the router, one is in the specialist. What are they?

In the interview

“Your agent sent a billing complaint to the technical specialist and the customer got a password reset instead of a refund. Walk me through it.”

Say your answer out loud, in under a minute. Then compare.

Notes