Autonomous software engineering agents routinely execute dozens to hundreds of tool calls, repository edits, and inference steps across a single task. Because model capability directly tracks compute cost, system architects increasingly rely on dynamic model routing: launching tasks on cheaper, lower-capability engines and escalating to frontier models only when an agent stalls. Developer environments have codified this pattern with mid-session controls like `/model`.

However, empirical data from AWS Agentic AI reveals that context handoffs between heterogeneous models impose a crippling performance penalty. In a study authored by AWS researchers Roy Ganz, Mor Shpigel Nacson, Adi Kalyanpur, and Ron Litman, the team demonstrates that mid-flight model switching forces the receiving engine to parse foreign logic and dead ends, quietly erasing the anticipated economic benefits.

The Anatomy of the Handoff Tax

When an advanced engine assumes control of an active trajectory, it inherits non-native syntax, intermediate tool artifacts, and reasoning paths generated by a weaker model. Benchmarking these transitions across low-cost (LC) and high-cost (HC) model pairs from Anthropic's Claude and OpenAI's GPT families, the authors found that passing unedited conversation histories severely blunts the performance ceiling of the receiving model.

Full-trajectory escalation recovers less than half of the LC-to-HC quality gap while incurring a substantial cost premium.

Rather than resolving the edge case efficiently, the incoming frontier model anchors to the flawed hypotheses and noisy tool invocations of its predecessor. Forced to process a bloated context window dominated by compounding errors, the premium model burns excess tokens while achieving task success rates well below its native baseline.

In operational terms, the dynamic resembles throwing a senior systems architect into an active incident with zero onboarding: if forced to reverse-engineer a hundred ill-conceived terminal commands executed by a junior engineer, the architect spends most of their compute budget untangling faulty assumptions rather than solving the root failure.

Asymmetric Interfaces and Trajectory Pruning

The study measured three distinct handoff interfaces across task execution percentiles: passing the complete raw trajectory verbatim, compacting historical turns into a synthesized summary, and aggressive trajectory removal, which wipes conversational history while maintaining repo-level workspace state. The empirical findings expose a fundamental operational asymmetry based on routing direction.

During upward escalation from a budget engine to a frontier model, stripping the prior conversational history consistently yields higher task completion rates. Advanced models perform significantly better when handed a clean repository state than when burdened with an inherited trace of low-quality reasoning. Conversely, downshifting from a frontier model to a cheaper engine requires the opposite architecture: lower-cost models depend heavily on the structured execution plans, scaffolding, and accurate mental models left behind by the stronger model. Purging context during a downshift causes budget model performance to collapse.

Naive model cascading cannot be treated as a basic token routing exercise. Passing unfiltered multi-turn histories across heterogeneous architectures actively corrupts agent reasoning. Enterprise agent workflows require directional context management: sanitizing or completely pruning execution histories during upward escalations, while preserving structured state representations when dispatching subtasks downward to low-cost workers.

AI AgentsLarge Language ModelsCost ReductionAnthropicOpenAI