Multi-Model Agent Routing: Assigning Models by Task Complexity
This article explains how to build a multi-model strategy for office AI agents by classifying tasks into tiers, designing rule-based and cascade routing, measuring success rate, latency, and cost per success with a custom benchmark, delivering complex tasks incrementally through a plan-execute-verify-revise loop, and managing model access at the enterprise level. Code examples illustrate routing logic, cascaded fallback, evaluation, and iterative refinement.
1. Background: Why Office Agents Need Multiple Models
Office agents handle a wide mix of tasks. In a single day, the same user might need to polish an email, extract action items from meeting notes, build a project schedule from a set of constraints, and check whether a policy document conflicts with existing workflows. These tasks differ greatly in reasoning depth, output length, latency tolerance, and acceptable cost.
If one model handles everything, three problems usually appear at once. First, complex tasks are limited by the model’s reasoning and planning ability. Second, if simple tasks use the same high-spec model, responses are slow and per-call costs are high, hurting both user experience and budget. Third, as call volume grows, total cost becomes hard to predict.
The core of multi-model selection is therefore not picking “the strongest model,” but finding the right balance of quality, speed, and cost for each class of task.
2. Start with Task Tiering
Task tiering is the prerequisite for model selection. Tiers are usually defined along three dimensions:
- Reasoning complexity: Does the task require multi-step reasoning, cross-document synthesis, or constraint solving?
- Interaction latency: Can the user accept a wait of several seconds or more?
- Fault tolerance: How costly is a wrong output?
The table below is a common tiering example; specific thresholds should be tuned to your own business data.
| Tier | Typical tasks | Key metrics | Selection tendency |
|---|---|---|---|
| Tier 1 | Polishing, summarization, information extraction, format conversion | Time to first token, per-call cost | Lightweight, fast models |
| Tier 2 | Rule analysis, plan review, structured comparison | Accuracy, output consistency | Mid-tier reasoning models |
| Tier 3 | Multi-step planning, cross-system orchestration, generating complete solutions or prototypes | Task completion rate, number of iterations | High-spec reasoning models, paired with verification |
Tier 1 tasks have clear objectives and outputs that can be checked quickly. The model only needs to understand text and transform it, so reasoning depth matters little and speed and price should come first. Users often trigger the next action while waiting, so time to first token affects the experience more than raw capability.
Tier 2 tasks require the model to understand rules and make judgments, such as comparing clauses across two documents or checking whether a plan satisfies a set of preconditions. Errors here directly affect decisions, so sufficient accuracy is required. However, inputs and outputs are usually not very long, and mid-tier models can generally cover these tasks.
Tier 3 tasks involve multi-step reasoning and tool calls. The model must break down the goal, execute sub-steps in order, and adjust the plan when intermediate results go wrong. These tasks demand the strongest planning ability and have the highest per-call cost, so they usually need verification steps and an iteration mechanism rather than relying on a single generation.
3. Model Routing Design
The routing layer decides which model to use when a task arrives. Three common approaches are rule-based routing, classifier-based routing, and cascade routing.
3.1 Rule-Based Routing
Rule-based routing maps observable features—task type, input length, whether tool calls are needed—directly to a model tier. Its advantages are predictable behavior and easy auditing, making it suitable for scenarios with stable task types.
from dataclasses import dataclass@dataclassclass TaskProfile:kind: str # task type, e.g. "rewrite", "extract", "plan"input_tokens: int # estimated input lengthneeds_tools: bool # whether multi-step tool calls are requiredtolerance: str # fault tolerance: "low" or "high"FAST_TIER = "fast-tier"BALANCED_TIER = "balanced-tier"REASONING_TIER = "reasoning-tier"SIMPLE_KINDS = {"rewrite", "extract", "summarize"}COMPLEX_KINDS = {"plan", "design", "orchestrate"}def route(task: TaskProfile) -> str:if task.needs_tools or task.kind in COMPLEX_KINDS:return REASONING_TIERif task.kind in SIMPLE_KINDS and task.tolerance == "high":return FAST_TIERif task.tolerance == "low":return REASONING_TIERreturn BALANCED_TIER
The order of checks in this code matters. Tool calls and complex tasks are routed to the top tier first, so they are not mistakenly sent to the fast model just because the input is short. The input length field is kept in the example; in a real system it can drive finer-grained rules, such as forcing an upgrade when input exceeds a threshold.
3.2 Cascade Routing
Cascade routing starts with a low-cost tier and escalates based on validation results. It fits tasks whose difficulty is hard to predict in advance but whose results can be objectively verified.
TIERS = ["fast-tier", "balanced-tier", "reasoning-tier"]def run_with_cascade(prompt, call_model, validate):attempts = []for tier in TIERS:answer = call_model(tier, prompt)attempts.append(tier)if validate(answer):return {"tier": tier, "answer": answer, "attempts": attempts}raise RuntimeError(f"All tiers failed validation, attempts: {attempts}")
The effectiveness of cascade routing depends on the quality of the validation function. If validation relies only on the model’s self-assessment, escalation decisions become unreliable. A better approach is deterministic checks: whether the output matches a structured format, whether values fall within a reasonable range, whether referenced fields exist. For tasks that cannot be validated automatically, keep manual spot checks or review steps.
Cascading also accumulates the cost and latency of multiple calls. Design should cap the maximum number of tiers and log the reason for each escalation, so you can later analyze which tasks frequently need upgrades and adjust the initial routing rules.
3.3 Choosing a Routing Strategy
Rule-based routing suits scenarios with clear task types and stable business rules. Cascade routing suits scenarios with widely varying task difficulty and mature validation methods. The two can be combined: use rules to set the starting tier, and enable cascading for uncertain tasks. Classifier-based routing—using a lightweight classifier to predict task difficulty—fits very high call volumes where rules are hard to enumerate, but it requires ongoing maintenance of training data and evaluation, so it is not recommended at the outset.
4. Measuring Quality, Latency, and Cost with a Benchmark
Model selection should not rely on public leaderboards alone. Leaderboard scores reflect general capability and may not match performance on your business tasks. Build your own benchmark and measure four things:
- Task completion rate: The proportion of outputs that meet acceptance criteria.
- Human edit rate: The proportion of outputs users need to modify, reflecting real usability.
- Latency distribution: P50 and P95 for time to first token and total completion time; P95 better reflects tail-end experience.
- Cost per success: The average spend per successfully completed task.
The last item is the most easily overlooked. Suppose a model has a low per-call cost but only a 60% completion rate. To get one successful result, you need multiple attempts on average, so the real cost can exceed that of a higher-priced model with a higher completion rate. The formula is:
Cost per success = average cost per call ÷ task completion rate
The average cost per call equals input tokens multiplied by the input price, plus output tokens multiplied by the output price. Calls generated by retries and cascade escalations should be included in the total cost.
Below is an example evaluation function that measures a tier’s performance on a benchmark set.
import statisticsdef evaluate_tier(tier, cases, call_model, judge):latencies, costs, passed = [], [], 0for case in cases:result = call_model(tier, case["prompt"])latencies.append(result["latency_ms"])costs.append(result["cost"])if judge(case, result["text"]):passed += 1p95 = statistics.quantiles(latencies, n=20)[18]return {"success_rate": passed / len(cases),"p95_latency_ms": p95,"cost_per_success": sum(costs) / max(passed, 1),}
There are several requirements for building the benchmark. Samples should come from real tasks and be stratified by task category, so that one overrepresented category does not hide problems in others. Samples need regular updates, since business scenarios and user inputs change over time. Judging functions should be as objective as possible—anything that can be checked by rules should not be left to subjective judgment. Evaluation results should be compared against online metrics before and after launch to confirm that offline conclusions actually reflect production behavior.
5. Incremental Delivery for Complex Tasks
Tier 3 tasks often cannot produce a satisfactory result in one pass. A more reliable approach is to produce a runnable first version and then expand it based on feedback. This pattern can be summarized as a “plan, execute, verify, revise” loop.
def iterate(goal, plan, execute, verify, revise, max_rounds=5):draft = plan(goal)result = Nonefor round_no in range(1, max_rounds + 1):result = execute(draft)passed, issues = verify(result, goal)if passed:return {"result": result, "rounds": round_no, "status": "passed"}draft = revise(draft, issues)return {"result": result, "rounds": max_rounds, "status": "needs_review"}
Four points matter in loop design. First, always set a maximum number of rounds; otherwise, if verification never passes, costs grow without bound. Second, verification should be as independent as possible from generation. Having the same model both generate and judge invites self-confirmation. Combine test cases, structural validation, rule checks, and human review. Third, record the inputs, outputs, and issue list of every round so failures can be analyzed later. Fourth, if the maximum rounds are reached without passing, mark the result for human review instead of delivering it directly.
Incremental delivery has an additional benefit: users can give feedback on the first version early, avoiding a long wait for a complete but wrong-direction result. For deliverables such as design drafts, solution documents, or data reports, the value of the first version lies in converging requirements sooner.
6. Enterprise-Side Model Access and Asset Management
Once model selection expands to multiple tiers, the enterprise also needs to decide who can use which tier. This typically involves permission management and asset governance across model tiers—for example, controlling access by role or team, tracking usage and cost per tier, and auditing which tasks were routed where—so that the multi-model strategy remains manageable as it scales across the organization.
