Skip to content

Choose model routing with model: router #76599

Done

Description

@rabeckett

Model routing is set today in its own block under engine, separate from where a workflow sets its model:

engine:
  id: copilot
  model-routing:
    goal: cost
    mode: economy

Routing is really just one way of choosing the model, so it's odd that it doesn't live in model. A workflow can set both, and then routing wins and the compiler prints a warning. Since #76313, a workflow with no model is routed by default. Asking for routing explicitly, though, still takes five lines and two required fields, and one of those fields doesn't do much: all 77 routing blocks in this repository use goal: cost. The block also makes imports awkward, because a workflow that imports routing settings has to use the object form of engine.

There's a longer-term reason too. Imports, sub-agents, experiments, and the GH_AW_MODEL_AGENT_<ENGINE> and GH_AW_DEFAULT_MODEL_<ENGINE> variables all take a model name. If routing can be written as a model name, each of those can ask for routing later without new settings. That would also help with team-wide defaults (#70297).

Proposal

I'd like to be able to choose routing with model, like this:

model: router/economy

There would be four values, one for each existing mode:

Value What it does Same as today
router The router picks the model and effort for each run, and judges how demanding each task is mode: auto
router/economy The cheapest model and effort that meet the lowest bar, for routine, low-risk tasks such as triage, labelling and summaries mode: economy
router/balanced The cheapest model and effort that meet a medium bar, for general-purpose work mode: balanced
router/robust The cheapest model and effort that meet the highest bar, for tasks where a failed run is costly mode: robust

These values work anywhere the main agent's model is set today: top-level model, engine.model, and imported workflows. The usual precedence still applies, so engine.model wins over top-level model, and a workflow's own model wins over an imported one.

Otherwise they behave exactly like engine.model-routing with goal: cost. They support the same engines and providers, and models.allowed and models.blocked still narrow the choice. Threat detection and evals aren't routed. The repository and organization model variables don't override an explicit router value.

Pinning a model works as it does today, for example model: gpt-6.1-sol, and engine.model-routing keeps working, so nothing existing breaks. It would also help if gh aw audit showed the requested value, such as router/economy, next to the model the router picked.

I avoided auto in the name on purpose. "Auto" already has several meanings: Copilot's Auto (copilot/auto), gh-aw's own auto alias, cursor/auto, kiro/auto, and OpenRouter's openrouter/auto, which is uncomfortably close to router/auto. The bar names are the existing mode names, so mode: economy simply becomes model: router/economy.

Router values also give the small and large aliases somewhere better to point. Today each of them resolves to the newest model that matches a fixed list of name patterns. Later, small could point at router/economy, and large at router/balanced or router/robust. Workflows that use them would then get the latest models, picked to suit each task. That change belongs in a separate issue, but it is one reason to write routing as a model value.

Examples

These should all work:

Configuration Result
model: router Routed; the router judges each task
model: router/economy Routed at economy
engine: {id: copilot, model: router/balanced} The same, set under engine
engine: {id: claude, model-provider: github, model: router} Claude on GitHub Copilot; Claude models only
model: router/robust with models: {blocked: ["claude-opus-*"]} Routed, but never to Opus
A shared file with model: router/economy Workflows that import it are routed, unless they set their own model

The compiler should reject these:

Configuration Why
router/fast, router/auto, router/Economy Not a router value; the error should list the valid ones
router/economy?effort=high The router chooses the effort; pin a model to set the effort
A router value and engine.model-routing in the same workflow Two ways to set the same thing
A router value with engine.fallback-models Routing can't be combined with fallback models, as today
A router value for a sub-agent, threat detection, evals or another job Only the main agent is routed
A router value in models.allowed, models.blocked, fallback-models or a models: alias These lists take models
A router value where routing isn't supported, such as Gemini, sandbox.agent: false or a custom endpoint The same errors as engine.model-routing

For now, a router value has to be written in the workflow itself. A value can also arrive through an expression or a variable, such as ${{ vars.MODEL }} or GH_AW_DEFAULT_MODEL_COPILOT. If it turns out to be a router value, the run should stop before the agent starts, with a clear message, rather than pass router/economy to the engine as if it were a model.

Docs

The Model Routing reference should lead with model: router, and the engine, frontmatter and glossary pages need matching updates. The model alias specification should reserve router. The workflow-authoring instructions in .github/aw/ currently teach engine.model-routing, so they should switch to the new form.

Out of scope

I'd keep a few related changes for separate issues:

  • deprecating engine.model-routing, with a gh aw fix codemod
  • accepting router values in the model variables, experiments and sub-agents
  • pointing the small and large aliases at router values

Activity

  1. locked and limited conversation to collaborators on Nov 10, 2026
  2. unlocked this conversation on Nov 10, 2026
  3. SivaKesava1 commented on Nov 10, 2026

    @SivaKesava1
    Collaborator

    Related: #76601 changes the implicit default (workflows with no model, about 92 locks today) from mode: balanced to mode: auto, which is what model: router means here. With both, "no model" behaves like model: router, and nobody has to name a mode.

    From recent runs (the classifier's recommendation is recorded in every selection record, even with a fixed mode): it recommends economy for 34 of 35 implicit-default workflows that have run, and agrees with the mode maintainers chose by hand in 53 of 56 explicitly routed workflows. So moving the explicit workflows to model: router later changes little: linter-miner (to balanced) and daily-tlc-test-expert (to economy) are the exceptions; the routing smokes should keep their bars.

    Suggest #76601 lands first, since it's a one-constant change and both touch reference/model-routing.md; this PR can then describe the default as behaving like model: router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions