Office Agent Routing Architecture: A Practical Guide to Multi-Model Collaboration
This article explains how office AI agents evolve from single-model setups to multi-model collaboration, and why intelligent routing becomes the core engineering capability. It covers a four-layer routing architecture, model profiling and evaluation, cost and latency governance, fallback strategies, and observability, with practical pseudocode and implementation recommendations.
1. Background: Why Office Agents Are Moving to Multiple Models
In mid-November, an office agent platform announced a model lineup update. In addition to keeping its in-house lightweight and high-performance models, it added several third-party general-purpose LLMs. On the surface, this looks like a model catalog expansion. In practice, it moves the agent from a single-model setup to multi-model collaboration. For developers, the important part is not the list itself, but the engineering capability behind it: selecting the most suitable model for each request.
Office tasks are highly heterogeneous. Document summarization requires long context and stable output. Table and structured extraction require strict format compliance. Meeting notes require low latency and conversational understanding. Cross-document comparison requires strong reasoning and low hallucination. No single model performs well across all of these dimensions, which makes multiple models a practical necessity. Routing is the mechanism that organizes these capabilities.
2. The Routing Problem: Optimal Selection Under Constraints
Routing can be formulated as a constrained decision problem. Given request features x, a candidate model set M, each model’s expected quality q(m,x) for a task type, unit cost c(m), and latency distribution l(m), the objective is:
minimize α * Cost(m,x) + β * Latency(m,x) - γ * Quality(m,x)subject to Latency_p95(m) <= L_maxBudget_remaining >= c(m)Policy(m) == allowed
Here, α, β, and γ are business-tunable weights. In engineering practice, teams do not solve a continuous optimization problem. Instead, they combine rules, classifiers, and bandit strategies to approximate the objective. The key point is that routing is not about choosing the strongest model. It is about finding a balance among quality, cost, latency, and compliance constraints.
3. A Layered Routing Architecture
A four-layer structure is recommended. Each layer narrows the candidate set and reduces decision complexity.
- Access layer: unified protocol adaptation. Wrap differences in message formats, tool-calling protocols, and streaming output across models behind a unified internal interface. The routing layer programs only against this internal abstraction.
- Profile layer: maintain capability tags for each model, such as context-length tiers, structured-output stability, code and math tendencies, multilingual coverage, and concurrency quotas.
- Decision layer: apply hard-rule filtering, task classification, cost evaluation, and exploratory sampling in sequence.
- Execution and feedback layer: initiate calls, collect metrics, write back samples, and drive policy iteration.
Illustrative interface (pseudocode):
def route(req) -> ModelHandle:candidates = [m for m in registry if policy_ok(m, req) and quota_ok(m)]task = classify(req) # summary / extract / chat / comparecandidates = [m for m in candidates if task in profile[m].strengths]scored = [(score(m, req, task), m) for m in candidates]scored.sort(reverse=True)if explore_enabled() and random() < eps:return random.choice(candidates) # exploration to correct profile biasreturn scored[0][1]
4. Model Profiling and Evaluation
Routing is impossible without evaluation. A three-layer evaluation system is recommended:
- Offline benchmark sets: built by office task category, covering long-document summarization, table extraction, multi-turn rewriting, and cross-document consistency checks. Each category should contain at least several hundred items with automatically measurable metrics.
- Automated metrics: field-level accuracy and format validity for structured tasks; key-point coverage and citation consistency for generation tasks. Also track repetition rate and refusal rate.
- Human spot checks: sample a fixed proportion every week, focusing on hallucination and tone fit. Human findings feed back into rule adjustments.
A profile is not a one-time document. It is a data table that updates with each release. Every model upgrade should trigger regression evaluation. If a metric drops beyond a threshold, the model’s routing weight is automatically reduced. This is the key mechanism for avoiding performance fluctuations when a new version goes live.
5. Cost Control and Latency Governance
Cost governance starts with tiering: classify requests by value, send high-value requests to stronger models, and route long-tail, low-risk requests to lightweight models. Common techniques include:
- Context trimming: retrieve and deduplicate first, then send only the necessary fragments to the model. Shorter input reduces both cost and latency.
- Semantic caching: build a vector-index cache for frequent similar questions and return cached results on a hit. Hit rate is often the most overlooked source of cost reduction.
- Batching and concurrency shaping: merge offline tasks into batches and shape online tasks by quota to avoid rate limiting at peak times.
- Streaming responses: prioritize time to first byte by splitting long generations into incremental output to improve perceived performance.
For latency, distinguish time to first byte from total completion time. Routing decisions should use the metric that matches business tolerance. Summarization can tolerate a longer total latency, while interactive rewriting must optimize time to first byte.
6. Failure Handling and Fallback Paths
The biggest benefit of multiple models is redundancy. A three-level fallback is recommended: switch within the same capability tier, fall back to a lightweight model across tiers, and finally fall back to a templated or retrieval-based answer while clearly informing the user. Idempotency and retry-budget control are also required to prevent the same request from being retried repeatedly across models and inflating costs.
try primary -> on timeout/failure -> fallback_same_tier-> on repeated failure -> fallback_light + notice-> on quota exhausted -> cached_or_template
7. Observability and Continuous Iteration
Metrics to collect should include at least routing distribution, success rate per model, quality score by task, cost per request, latency percentiles, fallback rate, and cache hit rate. Use a request identifier across the full path to build a traceable sample pool. Review the correlation between routing distribution and quality every week, and adjust weights with bandits or small-step policy changes rather than large one-off changes.
8. Implementation Recommendations on Baidu AI Cloud
For teams building on Baidu AI Cloud, the architecture can be supported with general capabilities: object storage for evaluation sets and sample pools, a message queue to decouple offline evaluation and batch processing, a container platform to host routing services with elastic scaling, and logging plus monitoring and alerting for routing metrics and fallback events. On the model side, follow the same pattern of multi-model access, unified abstraction, and policy routing. In-house lightweight and high-performance tiers can serve as the default baseline, while third-party general-purpose models provide capability supplements, with a unified gateway hiding the differences.
9. Conclusion
As office agents open up to multiple models, the focus of competition shifts from how many models are integrated to how smart the routing is. Make model profiling, evaluation regression, cost and fallback handling, and observability solid, and multiple models become a source of stability and cost efficiency rather than a complexity burden.
