Building-block guide · Performance and cost

Model selection and routing

How to pick, approve, route between and retire models: task-to-model fit proven by evals, an approved model list, routers and gateways, fallbacks with a total deadline, version pinning, residency and the open-weight versus hosted choice.

Draft for review · researched 30 Nov 2026

Contents
  1. At a glance
  2. Scope and where it sits
  3. When to use what
  4. Decision criteria
  5. Reference patterns
  6. Recommended defaults
  7. Anti-patterns
  8. Sizing and cost notes
  9. Security and compliance hooks
  10. Test and eval checklist
  11. Related plan sections and inventory
  12. Unverified or needs review
  13. Sources

At a glance

  • Select by eval, not by leaderboard. Baseline each task on the most capable approved model, then step down tier by tier while the pass rate holds. The KPI is cost per successful task at a fixed pass rate (plan section 4B).
  • Keep an approved model list as a governed catalogue with pinned versions, residency, data terms, eval scores, owner and retirement date for each entry. Agents call aliases from that list through the gateway, never raw provider endpoints.
  • Start routing with rules (task class to model alias). Add a learned or managed router only when traffic is mixed, volume is high and you can measure its decisions; research reports more than 2x savings without quality loss in that setting [9].
  • Switch models only at boundaries (session, sub-agent or phase). Prompt caches are per model, so per-request switching throws away cache savings [11][13].
  • Configure three fallback chains (provider errors, context overflow, content-policy refusals) under one total deadline, and run the eval on every fallback model [7].
  • Pin versions and plan migrations. Notice periods range from about two weeks for previews to at least six months for GA models at one provider and at least 60 days at another [1][2]. Each approved model needs a migration owner and a runbook.
  • Residency is a routing constraint, not a contract footnote. Pin inference geography where the client needs it, and check that caches, fallbacks and routers stay inside the same boundary [3][4][14].

Scope and where it sits

This guide covers choosing models for agent tasks, governing the approved list, routing requests between models, handling failures and refusals, pinning and retiring versions, data residency for inference, and the open-weight versus hosted decision.

In the 10-layer reference architecture (plan section 4):

Layer Model selection and routing responsibility
2 Agent gateway and edge security Model aliases, routing rules, budgets, provider credentials
3 Orchestration Planner and executor split, model per sub-agent or phase
5 Model layer and routing Approved list, routers, fallbacks, residency pinning, version pinning
9 Trust, safety and policy Which models may handle which data classes and risk tiers
10 Observability and AgentOps Per-model quality, cost, latency, refusal and fallback metrics

In the Anatomy of an AI Agent crosswalk this is Cortex (system 1: model portfolio and routing), governed through plan sections 4B and 16, with cost effects in Metabolism (system 10).

Related guides: Cost and latency engineering covers budgets, effort and cascades; Caching covers why model switches lose caches; Fine-tuning vs RAG vs prompting covers when a tuned model joins the list; Evaluations covers the suites that drive selection; Permission-aware retrieval and residency covers data residency for knowledge stores; Guardrails covers controls that must hold on every model.

When to use what

Option Use when Avoid when Cost and latency notes
Single model per agent Low volume, uniform tasks, early pilots Mixed easy and hard traffic at volume Simplest; caches stay warm
Planner and executor split Plans need reasoning; execution is routine tool work Steps are tightly interleaved Expensive model on few calls, cheaper model on many
Rule-based router (task class to alias) Task types are known at request time Task difficulty varies within a class No extra call; transparent
Classifier or learned router (for example RouteLLM) High-volume mixed traffic with labelled outcomes No outcome data; low volume More than 2x cost cut reported in research [9]; small routing overhead
Managed router (for example a cloud model router) You want routing as a service within one platform You need routing that learns from your data or spans clouds Router fees and model pool constraints apply [5][6]
LLM-as-router Routing needs reading comprehension of the request Latency-critical paths Adds a model call; use a small model
Cascade with verifier Cheap verification exists No reliable verifier Up to 98% lower cost in research [8]
Gateway with fallbacks Always, for production Never call providers directly from agents Small hop latency; central budgets and logs [7]
Hosted frontier model Hardest steps, broadest capability Strict residency or air gap not offered Highest price per token
Open-weight self-hosted Residency, control, steady high volume, tuning Small teams without serving skills You pay for GPUs and operations, not tokens

Notes:

  • Over three quarters of surveyed teams already use more than one model [12]; multi-model is the normal state, so governance must assume it.
  • Benchmarks narrow the shortlist; your eval decides. Public leaderboards measure general capability; agent tasks fail on tool use, long context and instruction following in your domain.

Decision criteria

  1. What does the task need? Long-horizon planning, coding or multi-constraint reasoning points to the top tier; extraction, classification, routing and summarisation usually do not. Prove it by step-down evals.
  2. What data class and risk tier? Restricted data limits you to models with suitable retention, residency and contract terms, whatever the eval says (plan sections 11 and 13).
  3. Where must inference run? If a client needs in-country or in-region processing, only models and endpoints that guarantee it qualify, and fallbacks must stay inside the same geography [3][4].
  4. Is task difficulty known before the call? Yes: rule-based routing. No, and volume is high: a learned router or a verified cascade.
  5. What is the latency budget? Tight budgets rule out LLM-as-router and long cascades; prefer rules and a single well-chosen model.
  6. How long will the model be available? Prefer GA models with long notice periods for production; previews can retire on short notice [2].
  7. Do you need to tune or inspect weights? Yes: open-weight models or a provider's managed tuning (see Fine-tuning vs RAG vs prompting).
  8. Can the team operate GPUs? No: hosted or managed serving. Yes, with steady high volume or residency needs: self-hosted open-weight serving becomes viable.

Reference patterns

1. Approved model list as a catalogue

Problem. Teams pick models ad hoc, call providers directly and discover retirements from error logs.

How it works. The CoE keeps one catalogue. Each entry holds: provider and exact version ID, alias exposed at the gateway, tier, allowed data classes and risk tiers, residency options, retention and training terms, eval scores per task family, price, context window, owner, notice period and announced retirement date. Agents reference aliases (reasoning-high, extract-fast) and the gateway maps them to pinned versions.

# Illustrative catalogue entry
alias: extract-fast
provider_model: <provider>/<model>@<pinned-version>
tier: small
data_classes: [public, internal, confidential]
residency: [eu]
evals: {invoice-extraction: 0.97, ticket-triage: 0.94}
notice_period_days: 180
retirement_date: null
owner: model-platform-team
fallbacks: [extract-standard]

When to use. From the first production agent.

Pitfalls. A list without eval scores becomes a popularity contest. A list nobody updates is worse than none; tie updates to the provider deprecation pages and usage exports [1][2].

2. Eval-first step-down selection

Problem. Teams default to the most expensive model or the cheapest one without evidence. Thoughtworks places blanket frontier model usage on Caution [11].

How it works. Build the task eval first. Run it on the top approved model to set the quality ceiling. Step down one tier at a time and stop when the pass rate drops below the agreed tolerance. Repeat per step type (planner, executor, summariser), not per agent. Record the result in the catalogue. Re-run on every model or prompt change.

When to use. Every new agent and every model upgrade.

Pitfalls. Evals that are too small hide regressions in the tail. Evaluate with production-like context lengths and tools. Compare on cost per successful task, not price per token.

3. Rule router plus learned router

Problem. Mixed traffic: most requests are easy, some are hard, and the agent cannot tell in advance.

How it works. Start with deterministic rules at the gateway (task class, tenant, data class, residency). For high-volume classes with outcome data, add a learned router that predicts whether the cheaper model will succeed. RouteLLM trained routers on preference data, cut cost by more than 2x without quality loss and generalised when the underlying models changed [9]. RouterBench provides more than 405,000 inference outcomes for evaluating routers [10].

Managed options exist with different constraints:

  • Microsoft Foundry model router routes across a pool (45 models listed as of 18 Nov 2026) with Balanced (default), Quality and Cost modes, a model subset you can restrict by policy, automatic failover on retryable errors and an effective context window equal to the smallest model in the pool [5].
  • Amazon Bedrock intelligent prompt routing routes between exactly two models from the same family using a response quality difference threshold, supports English prompts only and does not learn from application data [6].

When to use. Rules always; learned or managed routers when the eval shows savings and the constraints fit.

Pitfalls. A router that switches models inside a conversation breaks prompt caching; Foundry offers session affinity in preview partly for this reason [5]. Routers add a failure mode: log every routing decision and evaluate the router itself.

4. Three fallback chains under one deadline

Problem. Providers fail, prompts overflow context windows and models refuse. A single retry loop handles none of these well.

How it works. Configure separate chains, each tried in order, and give the whole request a total deadline owned by the orchestrator. LiteLLM, for example, distinguishes general fallbacks, context_window_fallbacks and content_policy_fallbacks, supports retries and cooldowns, and applies request_timeout per attempt rather than in total [7].

# Illustrative gateway routing (shape based on LiteLLM [7])
fallbacks: [{reasoning-high: [reasoning-high-alt-provider]}]
context_window_fallbacks: [{reasoning-high: [reasoning-long-context]}]
content_policy_fallbacks: [{reasoning-high: [reasoning-high-alt-provider]}]
num_retries: 2
request_timeout: 60      # per attempt; total deadline set in orchestrator

When to use. Every production agent.

Pitfalls. A fallback model that has not passed the agent's eval is an untested release. Content-policy fallback must never route around a legitimate safety refusal: restrict it to false refusals on approved content classes and log each use for review. Fallbacks must respect residency and data-class rules.

5. Version pinning and migration runbook

Problem. Model aliases move under you, and retirement notices arrive while teams are busy.

How it works. Pin exact versions in the catalogue. Track lifecycle stages: Anthropic uses Active, Legacy, Deprecated and Retired with at least 60 days' notice for publicly released models [1]; OpenAI gives at least six months for GA models, three months for specialised variants and about two weeks for previews, and lists gpt-5 and o3 shutting down on 11 Dec 2026 [2]. On a notice, the runbook runs: identify affected agents from gateway usage, shortlist replacements, run evals, shadow traffic, canary, cut over, update the catalogue, remove the old alias.

When to use. Continuously.

Pitfalls. Fine-tuned models follow the base model's retirement [2], so tuned variants need their own migration plan. Prompts tuned for one model may behave differently on its successor; budget time for prompt changes.

6. Residency-pinned routing

Problem. A client requires in-region inference, but routers and fallbacks can send traffic elsewhere.

How it works. Make geography a hard routing attribute. Anthropic's inference_geo parameter accepts global or us, costs 1.1x for US-only inference, applies to Claude 4.6 and later models, can be constrained per workspace and is reported back in the usage object [3]. Bedrock geographic cross-Region inference keeps processing within a geography (US, EU or APAC) while data may move between Regions in that geography [4]. OpenAI does not reuse prompt caches across regional processing boundaries [14]. Every fallback and router in the chain inherits the same constraint.

When to use. Any client with residency or sovereignty requirements.

Pitfalls. Global routing options in managed routers can conflict with residency; choose regional deployment types where offered [5]. Verify with usage or trace fields, not configuration alone [3].

Setting Default Range or options Why
Selection method Eval-first, step down from the top approved tier Per step type Practitioner default; plan 4B
KPI Cost per successful task at fixed pass rate Add p95 latency for interactive agents Plan 4B and 15
Model access Through gateway aliases only No direct provider keys in agents Practitioner default
Version Pinned exact version Floating aliases only in sandboxes Sourced [1][2]
Router Rule-based by task class and data class Learned or managed router with evidence Practitioner default, informed by [5][6][9]
Model switching At session, sub-agent or phase boundaries Never per request inside a conversation Sourced [11][13]
Fallback chains Provider errors, context overflow, content-policy refusals Each chain eval-approved Sourced [7]; plan 4B
Deadline Total deadline per request in orchestrator Per-attempt timeouts at gateway Sourced [7]
Production models GA only Previews in sandboxes Sourced [2] (short preview notice)
Migration lead time Start on announcement; finish 30 days before retirement Shorter for previews Practitioner default
Residency Pinned per client where required; same constraint on fallbacks Global where allowed Sourced [3][4]
Open-weight versus hosted Hosted unless residency, control, tuning or steady volume justifies serving Hybrid Practitioner default

Anti-patterns

  • Picking from a leaderboard. Fix: shortlist from benchmarks, decide with your own eval.
  • Hard-coding provider model IDs in agent code. Fix: gateway aliases mapped in a catalogue.
  • Per-request model switching inside a conversation. Fix: switch at boundaries to keep caches warm [11][13].
  • Untested fallback models. Fix: run the same eval on every model in each chain before release.
  • Using content-policy fallback to evade safety refusals. Fix: limit it to approved content classes, log and review each use.
  • Per-attempt timeouts only. Fix: a total deadline across retries and fallbacks [7].
  • Discovering retirements from errors. Fix: monitor deprecation pages, export usage by model and run the migration runbook [1][2].
  • Routers that ignore residency or data class. Fix: residency and data class are hard routing constraints applied before cost or quality.
  • Choosing self-hosting to save money at low volume. Fix: compare total cost including GPUs, idle capacity and operations against token prices at realistic volume.
  • One model for every step. Fix: planner and executor split with eval-backed tiers.

Sizing and cost notes

Price spread. FrugalGPT observed prices differing by about two orders of magnitude across models [8], which is why tiering matters more than negotiating a few percent off one model.

Illustrative routing saving. An agent handles 100,000 tasks a month. On the top model, each successful task costs $0.40 (illustrative). If evals show 60% of tasks pass on a small model at $0.05 per task and a rule router sends those classes there, the blended cost is 0.6 x $0.05 + 0.4 x $0.40 = $0.19, about 52% lower, provided pass rates hold. Add router overhead (managed routers charge a routing fee per million input tokens [5]) and the cache losses from switching.

Residency premium. Anthropic US-only inference costs 1.1x across token categories [3]; include it in business cases rather than discovering it on invoices.

Self-hosting break-even (illustrative method). Monthly GPU cost plus operations divided by monthly successful tasks, compared with hosted cost per successful task. Self-hosting tends to pay only with steady high utilisation; bursty traffic leaves GPUs idle. Use the plan's sizing worksheet for client numbers.

Migration cost. Each model migration needs eval runs, shadow traffic and prompt changes. Batch APIs halve eval costs (see Cost and latency engineering).

Security and compliance hooks

Threat OWASP mapping Controls
Compromised or unvetted model or provider LLM03 Supply Chain [15]; ASI04 Agentic Supply Chain [16] Approved list, vendor assessment, pinned versions, provenance for open weights
Fallback to a weaker model that skips safety behaviour LLM01 Prompt Injection; LLM09 Misinformation [15] Same guardrails and evals on every chain member
Routing restricted data to a non-approved model or region LLM02 Sensitive Information Disclosure [15] Data class and residency as hard routing constraints; usage geo checks [3]
Router manipulation (prompts crafted to force the expensive or weaker model) LLM10 Unbounded Consumption; LLM01 [15] Budgets, router decision logs, rate limits per user
Cascading provider failure ASI08 Cascading Failures [16] Multi-provider fallbacks, cooldowns, circuit breakers [7]
Agents bypassing the gateway with their own keys ASI03 Identity and Privilege Abuse [16] Provider keys held only by the gateway; egress controls

Data protection. Record each model's retention, training use, logging and residency in the catalogue. Managed routers can differ: Foundry states prompts are not stored by the router [5]; check every service in the path.

Audit evidence to keep. Catalogue history, eval results behind each approval, routing rules and their changes, fallback events, model version per trace, deprecation notices and migration records, residency verification.

Governing plan sections. 10 (supply-chain and threat model), 10A (gateway identity for provider access), 10B (policy decides which agents may use which aliases), 11 (residency and sector rules), 13 (registry links agents to models and risk tiers), 14 (higher autonomy may require stronger models or human review) and the ROE (to be defined, plan section 12), which may restrict model classes for regulated outcomes. Plan section 16 holds the vendor scorecard.

Test and eval checklist

ID Stage Check Pass criteria Priority
ROUTE-01 Design Task families and quality bar defined Eval suite and tolerance agreed per step type Must
ROUTE-02 Design Data class and residency constraints recorded Constraints mapped to allowed models Must
ROUTE-03 Design Catalogue entry complete for each model used All fields filled, owner named Must
ROUTE-04 Build Agents use gateway aliases only No provider IDs or keys in agent code Must
ROUTE-05 Build Versions pinned No floating aliases in production config Must
ROUTE-06 Build Routing rules versioned and reviewed Rules in source control with approvals Should
ROUTE-07 Test Step-down eval run Chosen tier is the cheapest meeting the tolerance Must
ROUTE-08 Test Router accuracy Routed pass rate within tolerance of top-model baseline Must
ROUTE-09 Test Every fallback model passes the agent eval Pass rate within tolerance; guardrails hold Must
ROUTE-10 Test Provider outage drill Traffic fails over within deadline; no duplicate side effects Must
ROUTE-11 Test Context overflow path Oversized request goes to long-context fallback or fails cleanly Should
ROUTE-12 Test Content-policy fallback restricted Genuine safety refusals are not rerouted Must
ROUTE-13 Test Residency verified Usage or trace geo fields match requirement on all paths Must
ROUTE-14 Test Cache behaviour with routing Cache hit rate holds; no per-request switches mid-session Should
ROUTE-15 Test Total deadline enforced Request ends by deadline across retries and fallbacks Must
ROUTE-16 Release Model approval recorded Approval with eval evidence in catalogue Must
ROUTE-17 Release Canary on model change Canary metrics within tolerance before full rollout Should
ROUTE-18 Run Per-model dashboards Quality, cost, latency, refusal and fallback rates per alias Must
ROUTE-19 Run Deprecation watch Notices reviewed weekly; runbook started within 5 working days Must
ROUTE-20 Run Quarterly portfolio review Catalogue re-evaluated against new models and prices Should

Governing policies and procedures

From the CoE policy set (draft; control IDs on the policy crosswalk):

Unverified or needs review

  • Google Vertex AI and Gemini model lifecycle and notice periods: the Vertex model versions page did not render, so no notice period is stated here for Google models.
  • The Bedrock intelligent prompt routing page lists supported model families that may change; the CLI example on the page names a Claude model not in its supported list [6]. Re-check before relying on it.
  • Foundry model router model count, modes and session affinity status are as of the page date (18 Nov 2026) and change often [5].
  • The open versus closed capability gap (Arena scores, Stanford AI Index 2026) is cited in plan section 16 and was not re-checked for this guide.
  • The 5-working-day runbook start and the 30-day migration buffer are practitioner defaults for the CoE lead to confirm.
  • Whether content-policy fallbacks should be allowed at all for regulated clients needs a CoE ruling.

Sources

  1. Model deprecations, Anthropic (Claude Platform docs), https://platform.claude.com/docs/en/about-claude/model-deprecations, accessed 30 Nov 2026.
  2. Deprecations, OpenAI API docs, https://developers.openai.com/api/docs/deprecations, accessed 30 Nov 2026.
  3. Data residency, Anthropic (Claude Platform docs), https://platform.claude.com/docs/en/manage-claude/data-residency, accessed 30 Nov 2026.
  4. Geographic cross-Region inference, Amazon Bedrock User Guide, AWS, https://docs.aws.amazon.com/bedrock/latest/userguide/geographic-cross-region-inference.html, accessed 30 Nov 2026.
  5. Model router for Microsoft Foundry (concepts), Microsoft Learn, https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/model-router, accessed 30 Nov 2026.
  6. Intelligent prompt routing, Amazon Bedrock User Guide, AWS, https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-routing.html, accessed 30 Nov 2026.
  7. Fallbacks, retries, timeouts and cooldowns, LiteLLM docs, https://docs.litellm.ai/docs/proxy/reliability, accessed 30 Nov 2026.
  8. FrugalGPT: How to Use Large Language Models While Reducing Cost and Improving Performance, Chen, Zaharia and Zou, arXiv 2305.05176, https://arxiv.org/abs/2305.05176, accessed 30 Nov 2026.
  9. RouteLLM: Learning to Route LLMs with Preference Data, Ong et al., arXiv 2406.18665, https://arxiv.org/abs/2406.18665, accessed 30 Nov 2026.
  10. RouterBench: A Benchmark for Multi-LLM Routing System, Hu et al., arXiv 2403.12031, https://arxiv.org/abs/2403.12031, accessed 30 Nov 2026.
  11. Blanket frontier model usage, Thoughtworks Technology Radar, https://www.thoughtworks.com/radar/techniques/blanket-frontier-model-usage, accessed 30 Nov 2026.
  12. State of Agent Engineering, LangChain, https://langchain.com/state-of-agent-engineering, accessed 30 Nov 2026.
  13. Prompt caching, Anthropic (Claude Platform docs), https://platform.claude.com/docs/en/build-with-claude/prompt-caching, accessed 30 Nov 2026.
  14. Prompt caching, OpenAI API docs, https://developers.openai.com/api/docs/guides/prompt-caching, accessed 30 Nov 2026.
  15. OWASP Top 10 for LLM Applications 2025, OWASP GenAI Security Project, https://genai.owasp.org/llm-top-10/, accessed 30 Nov 2026.
  16. OWASP Top 10 for Agentic Applications, OWASP GenAI Security Project, https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications/, accessed 30 Nov 2026.
↑