Model Routing

An issue triage workflow might get a one-line question today and a hard-to-reproduce bug tomorrow. With model: router, the main agent can use a less expensive model for the question and a more capable one for the bug. Routing chooses a model and reasoning effort for each run, not for each message.

Use routing when the work varies. Pin a model instead if the workflow needs a particular capability or you want the same model every time. Routing is experimental; it does not guarantee success or cap spending.

Set model: router in your workflow’s frontmatter. This workflow reads each new issue and posts one suggested next step:

---
on:
issues:
types: [opened]
permissions:
contents: read
issues: read
copilot-requests: write
engine: copilot
model: router
safe-outputs:
add-comment:
---
Read the issue. Suggest one next step that would help the author, and explain why.

If your workflow already pins a model under engine, remove that pin so the top-level choice takes effect. Run gh aw compile and commit the updated workflow and lock file together. This example uses GitHub Copilot authentication and the default firewall.

Set model toWhen to use it
routerLet each task determine the level. Start here for a workflow that handles a mix of requests.
router/economyFavor lower cost for routine work, such as labeling issues or summarizing activity.
router/balancedUse a consistent middle ground for general work, such as reviewing issues for missing information.
router/robustAim for a higher chance of success when a missed finding or a second attempt would be costly.

These are levels, not model names. Two runs at the same level need not use the same model. model: auto is different: it leaves model selection to the engine or provider rather than the gh-aw router.

The deprecated nested engine.model-routing.goal: cost-speed requires an AWF pin older than v0.29.17. With the default firewall, choose a cost-routing level explicitly; cost-speed is not an alias for cost.

To let the main agent choose between specific models, give it a shortlist alongside a literal router value:

model: router
model-routing:
allowed-models: [gpt-5.6-luna, gpt-6-sol]

Use exact model names or model aliases, not wildcard patterns. Declare the list once, either in the workflow or in a shared import.

The shortlist does not restrict sub-agents. For example, a Claude sub-agent can still use its own model while the main agent chooses between the two GPT models above, if the engine supports that combination. Copilot SDK mode supports mixed families; Copilot CLI mode needs the sub-agent and the selected main model to be in the same family. To restrict every model request in the main agent’s job, including sub-agent requests, use a model policy instead. A shortlist cannot override that policy.

Default routing for workflows without a model

Section titled “Default routing for workflows without a model”

Eligible workflows using GitHub Copilot inference already route when no model is set. To keep your usual model overrides and engine default without routing, omit model and set:

model-routing: false

Don’t combine the opt-out with a router value or shortlist. A configured runtime model override can take precedence over implicit routing, but does not bypass an explicit model: router.

Routing picks models from the live model catalogue. With engine.model-catalog: false (for example, for Azure AI Gateway), implicit routing is not applied and model: router fails compilation.

Copilot and Pi can route on GitHub Copilot. Claude and Codex can also route on GitHub Copilot with model-provider: github; Claude chooses among Claude models and Codex among GPT models. The Gemini engine does not support routing.

For Claude on Anthropic or Codex on OpenAI, set a router value explicitly. Routing uses your configured provider and its billing; it does not switch accounts or providers to find a model.

The routing tables in Agent Workflow Firewall (AWF) v0.29.17, the version gh-aw uses by default, include these GitHub Copilot model IDs:

FamilyGitHub Copilot model IDs
Claudeclaude-haiku-5.5, claude-sonnet-5, claude-sonnet-5.5, claude-opus-5.5
GPT 5.6gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra
GPT 6gpt-6-astra, gpt-6-luna, gpt-6-sol
GPT 6.1gpt-6.1-sol, gpt-6.1-terra
Geminigemini-3.8-flash, gemini-4-argon
MAImai-code-1.1-flash

For native OpenAI, the tables use the same GPT IDs. For native Anthropic, they use claude-haiku-5-5, claude-sonnet-5, claude-sonnet-5-5, and claude-opus-5-5.

At least one supported model must be enabled for the workflow’s provider account and eligible for its engine, model policy, and shortlist. A model also needs a compatible API endpoint and reasoning effort. If no model qualifies, the run fails before the main agent starts. If the workflow pins a different AWF version, check that version’s routing tables.

Run gh aw audit <run-url> and look at Model Routing. Compare the level you requested, the model and effort selected, and the cost with the work the agent actually produced. Use gh aw logs to compare several runs before deciding whether to change the level.

If the router found no eligible model, use gh aw audit <run-url> --models to see which models were available for that run, then check whether your engine, shortlist, or policy ruled them out. Widen the shortlist if appropriate; the router won’t pick a model outside it.

To keep a running record of which model and effort each run used, whether it completed its task, and what it cost, add adaptive-routing: observe. It never changes which model runs.

Updating an existing workflow after a compiler warning? See Migrate routing settings.