The capability
What a router is
A router is basically the part of a system that reads a request and picks which handler is going to do the work, and it makes that pick before any of the work happens. The handler might be a model, a piece of plain code, a retrieval pipeline, an agent or a person.
The word "picks" is carrying a lot of weight in that sentence, so let's be precise about what the router is picking from. It can only return a handler you already wrote into your code, which means there's no sixth option until somebody edits the code and ships it. That sounds like a restriction, and the restriction is the point, because when the list of options is closed, you can measure every one of them ahead of time. By the time you sit down to write the routing rule, you already know what the database lookup costs, what the cheap model costs, what the frontier model costs, and roughly how long each of them takes to answer.
The router also sits in front of the expensive work, so every millisecond it spends gets added to every request, including the ones it ends up sending to the cheapest handler. If a router takes four seconds to make up its mind, it's spent longer deciding than the handler will spend answering.
And it can be wrong in two directions, which cost you quite different amounts. If it sends hard work to a cheap handler, the customer gets a bad answer. If it sends easy work to an expensive one, the customer gets a perfectly good answer and you get a bigger bill. Section 7 is mostly about that gap, because when teams tune a router as though those two mistakes were equally bad, that's how they end up worse off than when they started.

One thing a router can't do is improve any of the handlers it calls. All it decides is which one gets the work, so if every option on the list is mediocre, what you get back is mediocre answers, just slightly more cheaply.
Three different things get called routing
People use the word routing for three different problems, and those tend to get solved by different people in different parts of a system, so it helps to pull them apart before we go any further.
Model routing is what most of this module is about. Something reads the request and decides whether it goes to the cheap model or the frontier one, the fast one or the thorough one.
Capability routing is a step up from that, because it decides what kind of handler answers at all. That might be a database lookup, a retrieval pipeline, an agent, or a person. Section 8 comes back to it, and at the flower company it turns out to be worth more money than model routing is.
Infrastructure routing decides which provider, region or deployment serves the call. You already built that one in M11-1, as the fallback chain and the load shedding that kick in when something breaks.
The first two are choices you make on purpose, before anything has gone wrong, while the third is mostly a reaction to a failure. That's why it sits in the rails and this module leaves it alone.
Why anyone bothers
Cost is the reason with the most evidence behind it, and it's the one section 5 puts numbers on. Most production traffic never needed the frontier model in the first place, so the money you spent sending it there was never buying you anything.
Latency is the second reason, and it's easier to feel than to measure. A small model answers faster, and somebody watching a cursor blink is going to notice the difference.
Quality is the reason people claim the most and measure the least. Some models are better at particular kinds of work, so a mix of them can beat any single model, but that argument only holds up if somebody ran the comparison.
Availability is the fourth reason, and it overlaps with what M11-1 already covered. If a router knows two paths, it can take the second one when the first is down, which is pretty much the same fallback, just with the decision made in advance.
Where it shows up
None of these examples is this module's running example, which starts in section 2.
- A chat product that has to decide whether a message needs a reasoning model or a fast one. ChatGPT does this, and section 6 looks at what happens when the provider makes that decision for you.
- A voice assistant that has to decide whether "open the calendar" is a command it can run on the device, or whether "what should I plant in November" needs a model. The first one gets matched against a list of known commands in milliseconds and never leaves the phone. The second one is a network call to something large, and the answer comes back as speech.
- A support agent that sends order lookups to a database and policy questions to a model.
- A coding assistant that chooses between a small model for autocomplete and a large one for a refactor.
- A triage desk of any kind, including one with people on the other end, which is the version that's been around for about a century longer than any of this.
Keep reading
The rest of this lesson is free with an account
Create a free account to read the remaining 12 sections. It takes about twenty seconds and there's nothing to pay. The same account opens the slide decks and CV reviews.
- 02Every turn costs the same at the flower company
- 03A router is a classifier whose labels cost money
- 04Wrong routes you can undo, and wrong routes you can't
- 05The flat mix, priced
- 06Pick the router your traffic can support
- and 7 more
That's the last one written so far
Pick your next module from the board.
