Multi-Model Routing for Office Agents: A Practical Engineering Guide

    This article explains how to build a multi-model routing layer for office AI agents that must handle long documents, spreadsheets, meeting notes, and email threads while calling external tools. It covers a four-layer routing architecture, four mainstream routing paradigms (rule-based, classifier-based, cascade, and parallel sampling with selection), coordination between context management and tool calls, a three-tier evaluation system, and the stability, cost, and governance practices needed in production. Readers will also find common pitfalls and a phased rollout path, with the emphasis kept on evaluation and fallback design rather than chasing a single model metric.

    1. Why Office Agents Need Multi-Model Routing

    Agents built for office work are fundamentally different from general-purpose chatbots. They have to process multimodal and unstructured inputs such as long documents, spreadsheets, meeting notes, and email threads, and they must call external tools like calendars, document stores, search, and approval systems to complete end-to-end tasks. No single model is best at every subtask: some excel at long-context summarization, some are more reliable at structured output and function calling, and some offer stronger reasoning at the cost of higher latency and resource usage.

    This is why the industry commonly adopts a “multiple models plus a routing layer” design. Requests first go to a dispatch layer, which decides which class of model fits the request and then forwards it for execution. The phenomenon described in the source material—an office agent platform that automatically selects models according to routing policies and gained a lead in traffic—essentially shows one thing: competition at the entry point is really a competition over dispatch quality. Good routing feels “fast and accurate” to users; poor routing feels “inconsistent.”

    Routing is not simply round-robin over a model list. It is an engineering system that involves intent recognition, task decomposition, cost constraints, and quality fallback. The sections below break it down layer by layer, from architecture to implementation.

    2. Layered Routing Architecture

    A maintainable routing system for an office agent is usually split into four layers:

    1. Access layer: handles authentication, rate limiting, and request normalization (unified message formats, file parsing, encoding handling), and tags requests from different sources with scene labels such as “document writing,” “spreadsheet processing,” “information retrieval,” and “workflow approval.”
    2. Understanding layer: performs intent recognition and task-complexity assessment, producing structured decision features such as whether long context is needed, whether tool calls are required, whether strict structured output is demanded, and the acceptable latency ceiling.
    3. Dispatch layer: maps requests to model tiers (light, general, strong-reasoning, long-context) according to policy, and handles retries, degradation, circuit breaking, and canary releases.
    4. Execution and governance layer: provides a unified wrapper for model calls, tool calls, result validation, logging, and billing instrumentation, forming an observable closed loop.

    The key benefit of this layering is decoupling policy from implementation. Model integration changes frequently while business policy is relatively stable; keeping decision logic in the dispatch layer prevents business code from being polluted by model details.

    A schematic policy interface can be abstracted as:

    1. @dataclass
    2. class RouteContext:
    3. scene: str # Scene label
    4. tokens_est: int # Estimated input size
    5. need_tools: bool # Whether external tools are required
    6. strict_json: bool # Whether strict structured output is required
    7. latency_budget_ms: int
    8. def route(ctx: RouteContext) -> str:
    9. if ctx.strict_json:
    10. return "general_tier" # Tier with more stable structured output
    11. if ctx.tokens_est > 120_000:
    12. return "long_context_tier"
    13. if ctx.need_tools and ctx.latency_budget_ms < 2000:
    14. return "light_tier"
    15. return "strong_reasoning_tier"

    3. Four Mainstream Routing Paradigms

    Rule-based routing is the most straightforward: hard-code mappings by scene, length, and output format. It is controllable, explainable, and adds zero overhead, but coverage is incomplete and boundary requests are easy to misjudge. It works well as a fallback and a canary baseline.

    Classifier-based routing treats model selection as a lightweight classification task trained on historical call logs. Features include text length, domain keywords, historical success rate, and user preferences. It is smoother than rules but requires continuous labeling and iteration, and you must prevent training-data bias from overusing one tier.

    Cascade routing starts with a low-cost tier and uses a validator to check whether the result meets the bar (for example, whether the JSON parses, whether citations are present, whether rule assertions pass), escalating to a stronger tier only when it does not. This is one of the most cost-effective paradigms because it spends “expensive model” calls only on genuinely difficult samples.

    Parallel sampling with selection issues calls to multiple tiers at once for high-value requests and picks the best result with a scorer (rule validation plus cross-consistency). The quality ceiling is high but resource consumption is large, so it is only recommended for low-frequency, high-value scenarios such as external contract review or generating key briefing materials.

    In practice, combinations are more common: rules act as a pre-filter, a classifier does coarse-grained tiering, cascades handle fine-grained escalation, and parallel selection is reserved for whitelisted scenarios.

    4. Coordinating Context and Tool Calls

    Office agent failures often do not come from “the model is not strong enough” but from poor context organization. The routing layer must work with context policy:

    • Context budget allocation: set quotas for system instructions, retrieved snippets, conversation history, and the current input; when space runs short, compress history first rather than truncating the current instruction.
    • Retrieval and routing coordination: when intent recognition determines that external knowledge is needed, retrieve first and then select the tier, avoiding the waste of stuffing large amounts of irrelevant content into a strong-reasoning tier.
    • Tier constraints for tool calls: structured function calls demand high format stability, so prefer tiers with proven capability in that area, and add parameter-schema validation and retry on failure at the execution layer.
    • Plan-execution separation for multi-step tasks: a strong tier generates the plan for a complex task, a light tier executes it step by step, and the strong tier returns to integrate the results. Alternating strong and weak tiers can significantly reduce overall cost.

    5. Evaluation: No Measurement, No Optimization

    The core asset of a routing system is its evaluation set. Three tiers are recommended:

    1. Offline fixed set: covers each scene and difficulty level, records success rate, average latency, and average resource consumption per tier, and forms a quality-cost curve.
    2. Online small-traffic experiments: split traffic by scene and track task completion rate, human adoption rate, retry rate, and escalation rate.
    3. Regression gate: before every policy change or new tier integration, run the offline set first and allow a rollout only if metrics do not regress.

    A simplified scoring function can be written as:

    1. def score(quality: float, latency_ms: int, cost: float) -> float:
    2. return quality - 0.05 * (latency_ms / 1000) - 0.2 * cost

    Weights should be adjusted by business stage: prioritize quality early on, and cost and stability in the mature stage.

    6. Stability, Cost, and Governance

    A degradation path must be designed explicitly: when the primary tier times out or trips its circuit breaker, degrade in a preset order while ensuring the degraded output still satisfies format constraints. Idempotency and retries must distinguish “safe to retry” (no side effects produced) from “not retryable” (an action such as an approval has already been triggered). For observability, log the decision features, selected tier, escalation reason, and final validation result for every routing decision, forming a traceable chain that makes it easy to diagnose “why this request was routed wrong.”

    On cost control, the trio of cascade, caching, and context compression usually delivers meaningful gains: a semantic cache intercepts duplicate requests, compression reduces input size, and cascades reduce the share of high-tier calls. If you use general-purpose cloud capabilities, you can store evaluation sets and call logs in object storage, use a message queue to smooth asynchronous task spikes, run the routing service on a container platform for elastic scaling, and rely on logging and monitoring with alerting for observability. These are common industry practices and are not tied to any specific vendor.

    7. Common Pitfalls

    • Treating routing as “more models is better.” Too many tiers add decision noise and operational cost; three to four tiers are usually enough.
    • Looking only at average metrics. Office workloads follow a long-tail distribution, so you must examine tail latency and worst-case samples.
    • Ignoring the coupling between prompts and tiers. The same prompt performs noticeably differently across tiers and needs separate tuning.
    • Lacking a human fallback. High-value scenarios should keep a human review entry point, positioning the agent as a productivity aid rather than a replacement.

    8. Phased Rollout

    In the first phase, get the loop working with rule-based routing and a fixed evaluation set. In the second phase, introduce classifier-based tiering and cascade escalation, and build a cost dashboard. In the third phase, pilot parallel selection in high-value scenarios and expand the evaluation set into a scene-tiered asset that supports continuous regression. Capabilities offered by Baidu AI Cloud in model services and engineering governance can serve as a reference for general technology selection, but the focus of implementation should always be the evaluation system and the degradation path, not chasing a single model metric.