ACRouter (Agent-as-a-Router) is an open-source (MIT), academic implementation of an agentic AI model router for coding tasks. The system dynamically routes a single task to one of several backend LLMs (e.g. cheap model โ verifier โ escalation to a stronger model), optimising the Pareto curve between response quality and inference cost. Source code is publicly available on GitHub at LanceZPF/agent-as-a-router (507 stars as of July 13, 2026).
Architecture: the ACRouter class (module acrouter_repro.inference) takes a candidate list, cheap chains, an escalation model (escalate_to), and a k parameter (attempts per stage). For each task: (1) calls the cheap model, (2) runs a user-supplied verifier (e.g. unit tests, execution checks), (3) on failure โ escalates to a stronger model. The decision returns as a Decision(chosen_model, final_response) object. The system was benchmarked on CodeRouterBench: 9,999 in-distribution tasks ร 8 models + 176 harder OOD (results: OOD176 AvgPerf=73.30 at $Total=86.72).
Runtime integrations: two ready-to-adapt adapters for popular Claude Code and Codex routing tools ship out of the box โ claude-code-router (gateway-level routing, before dispatching to the chosen backend) and cc-switch (proxy-level routing, before static provider mapping). The repo also contains two router demos โ api_coding_solver (via OpenRouter/OpenAI-compatible) and commercial_cli_router (for local Codex, Claude Code, Opencode).
Auxiliary assets on HuggingFace: dataset Lance1573/CodeRouterBench (benchmark), model Lance1573/acrouter-qwen35-08b-router-lora (optional router LoRA on Qwen3.5 0.8B). Requirements: Python 3.11, offline replay needs no API keys or live model calls.
Publication: Zhou et al., Agent-as-a-Router: Agentic Model Routing for Coding Tasks, arXiv:2606.22902 (2026). Authors: Pengfei Zhou (lead), Zhiwei Tang, Yixing Ma, Jiasheng Tang, Yizeng Han, Zhenglin Wan, Fanqing Meng, Wei Wang, Bohan Zhuang, Wangbo Zhao, Yang You. Homepage: omnisource.cn/agent-as-a-router. License: MIT.