Planned a model change that protects answer quality before reducing cost, with each route evaluated before it reaches people using the product.
01 · The need
A model change could alter answer quality or cost before the team noticed.
02 · What I changed
I designed one routing policy and an evaluation path for simple and complex conversations.
03 · Result or scope
The routing was planning and evaluation work. I also moved suitable workloads to a lighter model tier; no cost or latency saving is claimed for either.
Migrating the model behind a production agent is not a string replacement. It is
a behavior change, a cost change, a latency change and an operational risk all at
once.
This work focused on planning a safer Gemini migration for an LLM workflow that
already had real production constraints. The goal was to improve the system
without turning model choice into a brittle fallback tree.
The agent had to handle conversations with different levels of ambiguity. Some
turns were simple status or routing work. Others required more careful reasoning
around negotiation state, repeated counterproposals or legal language.
Using the same reasoning budget for every turn was wasteful. Splitting the
system into several model paths also risked making behavior harder to debug.
Model migrations often fail in the gaps between model quality and product
operation.
The obvious approach was to compare models and pick one. The production approach
needed more structure: what kind of task is this, how risky is the answer, how
much reasoning is justified, what should be logged and what evidence is needed
before rollout?
Projected savings were useful for planning, but they were not enough to publish
as production results. The migration needed an eval-first posture.
Case map · problem → solution → expected return
↔
This diagram separates shipped architecture from expected return: cost reduction remains a projection until evaluations and production telemetry confirm it.
The design favored a single-model migration with dynamic thinking levels.
Instead of scattering model selection across the codebase, the system could route
each turn through one decision point. That policy would consider task type,
conversation length, risk signals and operational context, then choose the
reasoning level for the model request.
In practice the policy resolved a higher reasoning level only on real complexity
signals — a large debt, a long conversation (past a turn threshold), legal
language detected in recent history, or an active legal proceeding on the record.
Simple analysis and summarization turns were pinned low. Every threshold lived in
configuration, so the team could tune behavior without a redeploy, and the model
choice itself stayed a single environment variable for emergency rollback.
One decision point chooses the reasoning budget. The context cache reuses the static prompt instead of resending it every turn.
The important part was not only the request. It was the evidence around it:
latency, token spend, tool-call correctness, fallback rate, operator overrides
and whether the conversation moved to the expected state.
A large static prompt was being resent on every turn. Caching it per tenant is
the structural cost lever — far more than per-token price shopping. The modeled
saving was roughly an 86% cut in input cost, but I kept that as a planning
estimate: until the eval harness confirmed it in production, it stayed a
projection, not a result.
Projected input cost per 1k requests
Projection only — modeled ~86% input-cost cut from per-tenant context caching, pending production telemetry. Not a measured result.
Alongside the routing design, I compared a standard and a lighter Gemini tier on
quality, latency and cost, and moved the workloads where the lighter tier was
good enough. The decision was per workflow, not a blanket swap, and it was paired
with context caching and a smaller context. I do not publish cost or latency
percentages for that move; the modeled input-cost figure above remains a
projection.
A single-model path reduces operational complexity, but it puts more weight on
the routing policy. Dynamic thinking saves reasoning budget on simple turns, but
it needs clear thresholds and instrumentation. Evaluation slows down the first
rollout, but it makes regressions visible before they become support work.
Those tradeoffs were acceptable because they made the system easier to explain.
If quality dropped or cost rose, the team could inspect one policy and one set of
metrics instead of hunting through several implicit model paths.
Cost in an AI product is architecture, not only pricing. A cheaper model request
does not help if the workflow retries, produces ambiguous tool calls or creates
manual cleanup.
The safest migration plan separated shipped production evidence from roadmap
projections. That made the plan more conservative, but also much easier to trust.