Agent-as-a-Router: Agentic Model Routing for Coding Tasks

Pengfei Zhou, Zhiwei Tang, Yixing Ma, Jiasheng Tang, Yizeng Han +6 more
6/22/2026
cs.AI

No confident code implementation found for this paper.

Abstract

Real-world users typically have access to multiple Large Language Models (LLMs) from different providers, and these LLMs often excel at distinct domains, yet none dominate all. Consequently, routing each task to the most suitable model becomes critical for both performance and cost.

Show full abstract

Existing routers treat this as a static, one-off classification problem. However, we identify the performance bottleneck for these routers as information deficit: simply augmenting a vanilla LLM router with performance statistics at the task-dimension level yields a 15.3% relative gain, surpassing a heuristic router built on the same dimension-level priors. Motivated by this finding, we propose Agent-as-a-Router, a framework that formalizes routing as a C-A-F loop (Context->Action->Feedback->Context). It closes the information gap by accumulating execution-grounded experience during deployment. We instantiate this framework as ACRouter, composed of an Orchestrator, a Verifier, a Memory module, and introduce CodeRouterBench, an evaluation environment comprising ~10K task instances with verified scores from 8 frontier LLMs, enabling regret-based router comparison on streaming tasks. Experiments show that ACRouter achieves the lowest cumulative regret on in-distribution tasks and generalizes to out-of-distribution agentic-programming tasks, demonstrating that our routing framework actively closes the information gap. Codes and benchmarks are released at https://github.com/LanceZPF/agent-as-a-router.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{zhou2026agentasarouter,
  title  = {Agent-as-a-Router: Agentic Model Routing for Coding Tasks},
  author = {Pengfei Zhou and Zhiwei Tang and Yixing Ma and Jiasheng Tang and Yizeng Han and Zhenglin Wan and Fanqing Meng and Wei Wang and Bohan Zhuang and Wangbo Zhao and Yang You},
  year   = {2026},
  eprint = {2606.22902},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.22902v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.22902.svg)](https://codeofpaper.com/paper/2606.22902)

Discussion