Guides  /  Models and routing

How does a request get routed to the right model?

Answer

A routing policy chooses the model for each task. The policy reads the class of work, the quality threshold for that class, the token budget, and the residency rule on the data.

Akka Optimize routes each task to the best model from any vendor, under policies you write. The choice is made in the runtime that executes the agent, so changing the model for a class of work changes no agent code.

The mechanism

Agent traffic is a mixture of tasks with different difficulty.

A single agent extracts fields from a document, classifies an incoming request, and reasons over a contract. Each of those tasks is a separate class of work with its own quality requirement. Sending every class to one model prices the easiest of them at the rate of the hardest.

Routing per task requires knowing which model handles each class of work well. Akka Optimize grades production traffic continuously, so every class carries a measured score for each model that has run it.

requestrouting policytask · threshold · budget · residencyfrontier modelthe class of work that needs itspecialized modeltrained on your own trafficsecond vendorfirst vendor is rate-limiting
What the policy reads

The routing decision has defined inputs.

The class of workThe kind of task the request belongs to, which is what the measured quality scores are attached to.
The quality thresholdThe score a response has to reach for that class, taken from the evaluations that already grade production runs.
The token budgetWhat the class is allowed to spend, which is what makes a cheaper model the choice once its quality reaches that threshold.
Where it may runResidency and vendor rules, so a task carrying regulated data reaches only the models permitted to receive it.
Provider stateA rate limit or an outage at one vendor is a routing input, so the task moves to another model that meets the same threshold.
What routing changes

Model choice stops being a code change.

A model named in application code makes every model change a release. A team in that position runs a migration each time a provider ships a new version, and the migration touches every agent that named the old one.

A routing policy keeps the choice outside the agent. Adding a model, retiring one, or moving a class of work from a frontier model to a specialized one is a change to the policy, and the agents that route through it are untouched.

A specialized model trained on your own traffic is the cheapest destination the policy can name. Specialized models run faster and consume up to 80% fewer tokens than foundry models on the class of work they were trained for.

Questions

Related questions.

Who writes the routing policy?

The team that owns the agent and its budget writes the policy, and compliance owns the residency rules it has to respect. Routing is configuration in the runtime, so a revision does not require an application change.

How is the best model for a class of work decided?

Graded production traffic decides it. Every run is scored against the criteria set for its class, so the comparison between models is measured on the work the system actually does.

What happens when the chosen model is unavailable?

The policy names the models each class of work may use. When one of them is rate-limiting or down, the runtime sends the task to another model that meets the same threshold.

Does routing lock the system to one vendor?

Routing spans vendors, and a class of work can name models from several of them. Native A2A, ACP and MCP support keeps agents and tools interoperable across vendors, models and runtimes.

On Akka. Per-task routing across vendors, grading and token reporting are capabilities of Akka Optimize.