Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

LangChain 11 min read Case study mediumAdept

How to Build a Model Router in the Harness

Routing each coding-agent thread to one of three model tiers (fast, balanced, performance) cut median cost per thread by 64% versus always using a top frontier model, with no measurable change in merged-PR rate (29.2% vs 27.3%, p=0.49) across 973 threads in Open SWE. The router runs as harness middleware, classifying the first user message against per-tier criteria. Those criteria come from trace-based task analysis and provider guidance, which is why it belongs in the harness rather than a generic gateway. Most threads went to the balanced (56%) or fast (34%) tiers. A fast-only control degraded quality so quickly it was stopped within a day. Future work includes subagent routing and mid-thread re-routing, which carries a prompt-cache cost.

Related posts

  • Model Routing Is Simple. Until It Isn’t.

    Hugging Face easyNovice

    LLM model routing in agentic systems is a systems optimization problem, not a classification one. On 417 AppWorld tasks with a CodeAct agent, Claude Sonnet 4.6 cost $0.19/task versus GPT-4.1's $0.37 despite higher list prices and about 3x more steps, because cheap cache reads dominate agent workloads. Task difficulty is often invisible at routing time and competes with latency, compliance and reliability constraints, and latency depends on serving conditions and routing granularity. IBM's optimization-based router traces a cost-accuracy frontier: one configuration reached 84% accuracy with 21% lower cost and 9% lower latency than Opus alone, at about 6 ms and 2 kB overhead per task.

  • How Cursor Router chooses the right model for the task · Cursor

    Cursor mediumAdept

    Cursor Router picks a model per agent turn in two stages: Compass, a complexity predictor trained on implicit user-satisfaction signals (moving on vs. correcting the agent), decides whether a turn stays on a cheap model (Grok) or gets upgraded. Upgraded turns are classified by a learned taxonomy of domains, tasks and modifiers and sent to the frontier model with the best observed performance there. A candidate must clear a one-sided 75% confidence uplift over the cheap model, and an optimizer picks the traffic-weighted model mix that maximizes expected gain within each mode's per-turn cost budget. Policies were tuned with cross-validation, checked on a held-out set, then validated on live traffic. Auto Intelligence now beats Fable-level satisfaction at 68% lower cost, and Auto Balance beats Opus 4.8 at 41% lower cost.

  • The Open Source AI Stack

    Together AI easyNovice

    Adopting open models for agentic coding is framed as a five-layer "MIGHT" stack: model, inference provider, gateways/routers, harness and tools (skills and MCP), with each layer swappable independently so new models can be tried in minutes. Large MoE models like Kimi K3 suit ambiguous multi-step work such as refactors and debugging, while small models like GLM 5.3 Flash are roughly 20x cheaper and match them on tightly scoped tasks. Gateways such as OpenRouter, Vercel AI Gateway and LiteLLM route across providers, and harnesses like OpenCode or Amp execute the tool calls the model requests. The practical advice is to treat model choice as tool selection and to start fresh sessions often to keep context clean.

  • Introducing harness adapters: adapt your favorite model to your harness to improve performance and cost

    Hugging Face hardMaster

    RL-training a LoRA adapter for a specific agent harness and task distribution makes a frozen base model both more accurate and cheaper: Qwen3.8-27B under the pi harness rises from 39% to 55% pass@1 on Terminal-Bench 2.1 while average token usage drops from 2.9K to 1.5K per task, mostly because the model reasons less and calls fewer tools. The recipe trains one adapter per harness (pi, OpenCode, Hermes Agent) inside the unmodified harness, using a proxy to vLLM and TRL's AsyncGRPOTrainer. It builds a validated, difficulty-filtered task set from SWE-smith, SWE-Gym and Tasksmith-generated PR tasks using openenv validate, keeping only tasks the base model solves sometimes. The post also covers learning-rate sweeps (settling on 2e-5), a small tool-efficiency reward bonus, safeagents guardrails during rollouts, and merging the three nearly orthogonal adapters into one super-adapter that works across all harnesses.

  • AI Agent Latency 101: How do I speed up my AI agent?

    LangChain easyNovice

    AI agent latency can be cut in five ways: find the bottleneck first (e.g. with per-step tracing and a waterfall view), reduce perceived latency through UX, make fewer LLM calls, make each call faster, and run calls in parallel. Streaming intermediate steps such as plans, retrieval results or thinking tokens can raise user satisfaction without changing total time, and event-triggered background agents hide latency entirely. General-purpose multi-agent supervisor or swarm setups make many LLM calls, so mixing code with explicitly routed calls reduces them. Smaller models and shorter context speed up individual calls at some cost to accuracy, and guardrail checks, multi-document extraction or multi-model calls can run concurrently.

The quest for software engineering knowledge.

Look:
Layout: