Improving

AI Agent Dispatcher Patterns To Survive the Model Swapping

Devlin Liles Headshot

Devlin Liles

Chief AI Officer, CCO

November 12, 2026 | 9 Minute Read

Model providers update APIs, release new versions, deprecate old ones, and adjust pricing on a timescale of months, sometimes weeks. Agent logic changes more slowly than that.

Production software already solved the same problem for storage. The application does not know which database host it is talking to. It talks to an abstraction layer that routes to the appropriate host, because the host changes more often than the logic built on top of it, and coupling the two creates a migration cost that compounds with every change. David Parnas named the principle information hiding in 1972: isolate the decision most likely to change behind an interface that does not change with it.

Among the AI agent architecture patterns I have shipped in production, the one I return to most applies that idea to model selection, and enterprises skip it more than any other. The dispatcher pattern is a model routing layer that accepts a task request, selects the model based on the task’s actual characteristics, and returns a result in a common format regardless of which model handled it. Agent code sees only the task it submitted and the result that came back.

Dispatcher Among AI Agent Architecture Patterns

An AI agent architecture pattern is a reusable structure for how an agent receives tasks, reaches models and tools, and returns results. In agentic AI architecture, some patterns decide how agents divide work, such as orchestrator-worker and multi-agent designs. The dispatcher pattern decides which model handles each task, and it keeps that decision in configuration.

Importance of Decoupling Agents From Models

A team that wires agents directly to one provider pays at every model transition, in engineering hours spent hunting down references and in per-task spend on a model tier that may be more than the task needs. The cost sits dormant until the model changes, and then it arrives all at once. Price gaps make the cost concrete.

In an April 2025 Improving comparison on Amazon Bedrock, Amazon Nova Pro came in 68% cheaper than OpenAI’s gpt-4o on list price per million tokens. A team with agents wired directly to one provider cannot act on a gap like that without a rewrite, which is why multi-provider LLM routing belongs in the architecture early.

Recognize Four Signs of Model Coupling

Coupling to a model is easier to spot in its symptoms. Four show up repeatedly:

  • Hardcoded model names: A model name appears as a string constant scattered through application code. With one model, a version change is a find-and-replace. With five models serving five purposes, it is a change that touches half the codebase.

  • Prompts tuned to one model's style: Model families respond differently to phrasing, and a prompt tuned for one can produce degraded output on another because the instruction framing no longer matches what the new model was trained to expect. Every prompt in the system inherits the retuning cost.

  • Response parsing tied to one output format: Parsing fails silently when a different model structures its output differently. A silent parse failure is worse than a crash, because nothing alerts anyone that the data downstream is now wrong.

  • Retry and error handling written for one provider: Rate limits, context-length errors, and content-policy rejections each have their own shape per provider. Error handling calibrated to one provider mishandles another's failures, so the system degrades exactly when it needs to be resilient.

The dispatcher pattern moves all four out of scattered agent logic and into a single dispatch layer, where they are managed once. The decision belongs early in custom AI and ML development work, before agent code has shipped against a single provider.

A common mistake is moving the model name into a config file and calling the system decoupled. The prompts, the parsers, and the error handling still assume the old model, so a swap produces worse output with no error while the config looks clean.

Build Three Layers Into the Dispatcher

Layer 1: AI Model Routing With a Classification Table

The routing layer accepts a task request built from two inputs: the task content and a classification describing the task along the dimensions that determine which model fits. Those dimensions are:

  • Reasoning depth

  • Context window size

  • Output format

  • Latency sensitivity

  • Cost tolerance

A routing table maps classifications to model selections. Teams sometimes call this component an LLM router or model router. Simple, well-defined tasks route to smaller, faster, cheaper models, and tasks requiring synthesis across large context or multi-step reasoning route to models built for that.

The table is a configuration artifact, so moving a task type to a different model, for cost, for quality, or because a new model shipped, becomes a table edit that needs no deployment. Microsoft Foundry offers a managed model router that applies a similar idea as a service.

Layer 2: Adapt Prompts for Each Model

The prompt adapter is the layer teams skip, because it looks like extra work until the first model swap proves otherwise. Each model in the routing table gets an adapter that transforms the agent's canonical prompt format into what that model expects: instruction prefix conventions, system prompt structure, and tool specification format.

Agent code writes prompts once, in the canonical format, and the adapter does the translation. The adapter is a one-time investment per model, and it saves retuning every prompt each time a model changes.

Layer 3: Normalize Output Into One Format

Two models given structurally identical requests produce structurally different responses: keys named differently, null values handled inconsistently, the JSON payload wrapped in whatever structure the model prefers.

Each model's adapter normalizes its output into the format agent code already expects, so agent code receives a consistent structure no matter which model ran the task.

Encode Model Differences in the Routing Table

The routing table is where the quality and cost characteristics of each model, for each task type, get written down. A cheap, fast model handles simple classification because someone evaluated it on that task and it performed well. The dispatcher records that knowledge as configuration.

A property-technology client I worked with builds this discipline into its architecture. It pins a specific model version to each of its AI skills in production. When a new version ships, nothing routes to it automatically. The update triggers a re-approval and a regression run against that skill’s existing test suite before the skill may use it. For this client the routing table doubles as a governance control, and every routing decision has test results behind it.

Test Cheaper Models Against Your Golden Dataset

Running the existing golden dataset for a task segment against a candidate lower-tier model, with the same scoring rubric used for the current model, answers whether the cheaper option meets the quality floor for that segment. Public benchmark leaderboards cover a general task mix, so they cannot say whether a cheaper model meets your quality floor. The discipline matches the ratchet pattern, quality gates that only move forward: a routing change earns its way in with evidence or it does not ship.

Simple, well-structured tasks such as template composition, bounded summarization, and structured output generation meet the quality floor on smaller models more often than tasks with ambiguous instructions or long-context synthesis.

In my experience, the quality gap between tiers is largest on the tasks hardest to specify clearly, which is also where teams are most tempted to assume the frontier model is required. Test those tasks first. An unchecked assumption there is the most expensive one in the pipeline.

Quantify What Skipping the Dispatcher Costs

Model pricing across capability tiers can differ by a factor of five to fifteen within a single provider’s lineup. If every task routes to the frontier tier because nothing was built to route it elsewhere, the weighted cost per task sits at the high end however many tasks were simple enough for a fraction of the price.

Illustrative numbers show the size of the gap. Say the frontier tier costs 1.0 per task and a smaller tier costs 0.1, a 10x spread. If 70% of tasks are simple enough for the smaller tier, routing brings the weighted cost to 0.7 × 0.1 + 0.3 × 1.0 = 0.37. Sending everything to the frontier tier costs 1.0, which is 2.7 times the routed figure (1.0 ÷ 0.37). The more the pipeline skews toward simple tasks, the larger the savings from routing.

Image - AI Agent Dispatcher Patterns To Survive the Model Swapping

Time costs compound too. Without a dispatcher, every model change forces a choice: absorb degraded service from a deprecated or struggling provider, or push an emergency code change through review, testing, and deployment to route around it.

Both options cost more than a configuration update, and both repeat. Over three or four model transitions, a realistic count for any team running agents in production for more than a year, the repeated migrations can outweigh the cost of building the dispatcher in the first place.

Our webinar on controlling token costs without sacrificing performance covers the spending side in more depth.

Skip the Dispatcher When It Is Overkill

A dispatcher on day one of every agent project is the wrong default. A team running a single model with no near-term plan to change it carries no coupling cost, because nothing ever exercises the coupling.

A basic dispatcher, meaning a routing table plus adapters and normalizers for the initial model set, runs a few days of engineering. The investment pays for itself at the first model transition for any team with more than one model in play, and for any team operating where model releases arrive faster than its own release cadence. Most enterprise AI programs I have worked inside over the past two years fit that description.

Stop Betting on a Stable Model Landscape

In enterprise AI agent architecture, the dispatcher is the pattern that assumes the model landscape will keep changing. Skipping it is a wager that models will hold still long enough for the coupling never to matter. That wager was defensible in 2022, when the field moved in years. Providers now ship material model updates within months, and sometimes weeks, and pricing tiers shift under contracts signed on the assumption of stable rates. The dispatcher earns its place by keeping agents running through those changes.

Before your next model contract renewal, put two questions to your team. How many files would need to change if you swapped providers tomorrow? When did a task type last get re-tested against a cheaper model? Most teams can answer the first. Far fewer can answer the second, and it is usually the more expensive gap. If nobody has revisited a pipeline’s model choice since launch, block thirty minutes this quarter to do it.

If you would like to map where model coupling sits in your agent pipelines today, Improving’s AI team can walk through it with you.