TRACE-ROUTER: Task-Consistent and Adaptive Online Routing for Agentic AI

Ritik Raj, Souvik Kundu, Sarbartha Banerjee, Dheemanth Joshi, Ishita Vohra, Tushar KrishnaarXiv 2026

TL;DR

Traditional LLM routers make independent decisions for every single request, which fails miserably for multi-turn AI agents where success is only known at the very end of a task. TRACE-Router solves this by routing the entire execution trace of a task to a single backend model at admission using an online contextual bandit. By aligning the routing decision with the actual unit of feedback, it achieves optimal accuracy-latency trade-offs without requiring offline training data.

What Problem Does This Paper Address?

When deploying Large Language Models (LLMs) in production, balancing cost/latency (using smaller models) and accuracy (using larger models) is critical. Existing routing frameworks handle this by looking at an incoming prompt and predicting which model should answer it.

While this request-level abstraction works perfectly for single-turn queries, it breaks down for agentic workloads. AI agents execute long-horizon, stateful workflows involving multiple LLM calls interleaved with tool use, code execution, and environment transitions. If a request-level router decides to switch to a smaller model halfway through a complex task, it can discard model-specific state and cause the entire execution to fail. More importantly, because task success or failure is only observed at termination, per-request routers suffer from a credit assignment problem—they cannot easily determine which specific routing decision caused the final failure.

Methods

TRACE-Router introduces task-consistent online model selection, shifting the routing granularity from individual requests to entire task traces.

Figure 2: TRACE-Router overview. Each request carries a persistent task identifier. Requests from an active task reuse its stored backend assignment, while a new task is assigned a coarse context and routed by the corresponding bandit; the figure illustrates a three-context instantiation. After task completion, graded accuracy and end-to-end latency are combined into a delayed reward that updates the bandit responsible for the routing decision.

The framework operates via four core components:

  1. Task-Consistent Routing: When a task is initiated, the router assigns it a unique task_id. The first routing decision binds the entire task trace to a specific backend model, and all subsequent requests carrying that task_id reuse the same backend.
  2. Context-Conditioned Selection: At admission, a lightweight context function (such as a regex-based complexity classifier) categorizes the task into coarse difficulty tiers (e.g., EASY, MEDIUM, HARD).
  3. Online Bandit Policy: TRACE-Router maintains an independent multi-armed bandit (specifically, a Cold-Start Contextual Upper Confidence Bound (UCB) algorithm) for each context tier. It learns which model works best for which tier completely online through exploration.
  4. Scalarized Delayed Reward: Once a task terminates, its final graded accuracy ($a$) and end-to-end latency ($\ell$) are combined into a single scalar reward using a preference parameter $\alpha \in [0, 1]$: $$r^{(\alpha)} = (1 - \alpha)a - \alpha\tilde{\ell}$$ This reward is then used to update the specific bandit that made the initial routing choice.

Datasets

The authors evaluated TRACE-Router across three distinct agentic benchmarks using pairs of smaller and larger models (primarily from the Qwen3.5 family):

  • $\tau^2$-Bench (Retail & Telecom domains): Evaluates conversational agents acting in realistic, multi-turn customer service environments with tool use and databases.
  • LiveCodeBench: Focuses on code generation and software engineering tasks, evaluated using difficulty-weighted pass@1 metrics.
  • Terminal-Bench: A benchmark consisting of system administration and terminal-based tasks.

Key Insights and Ideas

  • The "Granularity Match" Principle: The core philosophy is that the unit of routing must match the unit of feedback. If feedback is only available at the task level, routing must happen at the task level to enable principled credit assignment.
  • Weaker Backends Can Be Slower: Counterintuitively, routing a hard task to a smaller model doesn't always save time. In agentic workflows, a struggling model often exhausts its maximum turn budget or hits timeouts, resulting in higher latency than a larger model that resolves the task quickly. TRACE-Router naturally learns to avoid these "latency traps."
  • Cold Start Beats Warm Start: The authors experimented with a prior-warm-started bandit variant but found that cold-start UCB performed better. Warm-starting tended to over-rely on the prior, suppressing the exploration needed to discover model complementarities.

Key Results

TRACE-Router consistently holds the interior Pareto frontier across all tested benchmarks, outperforming both single-model baselines and traditional request-level or semantic routers.

Figure 3: Accuracy–latency frontiers. Marker shape denotes method, color denotes preference α; non-swept baselines are gray. Rings mark the non-dominated set and the connecting line the empirical Pareto frontier. Stars are task-matched oracles, excluded from the frontier. TRACE-Router holds interior frontier positions on all three benchmarks, dominates the smaller backend outright on telecom, and on Terminal-Bench holds a position strictly above the larger backend.
  • On $\tau^2$-Bench: TRACE-Router outperformed a latency-matched random mixture of individual models by 7 to 8 accuracy points. At its optimal operating point, it captured 90% of the accuracy gap between the small and large models while consuming only 67% of the latency difference.
  • On Terminal-Bench: It achieved 7.1 higher accuracy points than always serving the strongest single model baseline, while simultaneously reducing latency by 36%. This occurs because the two backend models excel at completely different subsets of tasks, allowing the router to exploit their unique strengths.

Limitations and Future Work

While TRACE-Router demonstrates strong gains, it relies on a coarse, static context classifier at admission (e.g., regex keyword matching). A more sophisticated, yet low-latency, embedding-based or LLM-based context identifier could potentially yield cleaner task partitioning.

Additionally, the current framework strictly pins a task to a single model from start to finish. While this preserves state consistency, future work could explore hierarchical routing or structured "escalation" policies (e.g., starting with a small model and handing off to a larger model with state transfer) to handle unexpectedly shifting task complexities mid-execution.

Summary updated

BibTeX
@misc{raj2026trace,
  author = {Ritik Raj and Souvik Kundu and Sarbartha Banerjee and Dheemanth Joshi and Ishita Vohra and Tushar Krishna},
  title = {{TRACE-ROUTER: Task-Consistent and Adaptive Online Routing for Agentic AI}},
  year = {2026},
  eprint = {2607.22465},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.22465},
}
Figure