<!--
Sitemap:
- [Installation](/installation): Install the Bento daemon on macOS or Linux, then write your first pipeline to run a coding agent on a GitHub, Linear, or schedule event.
- [Upgrading](/upgrading): Version-specific steps for upgrading an existing Bento install.
- [Concepts](/concepts)
- [Build your first pipeline](/tutorials/pipeline-args)
- [Target a specific issue or PR from a URL](/tutorials/url-targeting)
- [Keep state across runs](/tutorials/pipeline-state)
- [Fire a pipeline on a schedule or on demand](/tutorials/schedule-and-fire)
- [Deploy a box to Railway](/tutorials/deploy-to-railway)
- [Operate a hosted daemon](/tutorials/operate-a-hosted-daemon)
- [Configuration](/configuration): Configure the Bento daemon with daemon.yaml: service name, port, webhooks, sandboxes, knowledge base, and environment variables.
- [Members](/members)
- [Knowledge base](/knowledge-base/)
- [Method and delivery](/knowledge-base/modes): Choose how Bento retrieves knowledge (BM25, vector, or hybrid) and how it delivers that knowledge to a coding agent.
- [Config](/knowledge-base/config)
- [MCP](/knowledge-base/mcp): Give coding agents your team knowledge over MCP. The Bento daemon serves an ask_knowledge search tool and per-file resources.
- [Pipeline configuration reference](/pipelines/config): Reference for Bento pipeline YAML: triggers, agents, skills, instructions, filters, sandboxes, structured results, and outputs.
- [Filters](/pipelines/filters): Filter GitHub, Linear, and webhook events by repository, label, and other fields so only the right Bento pipelines run.
- [Workflows](/pipelines/workflows): Group related Bento pipelines with their own agents, skills, and policies in one workflow directory under .bento/workflows.
- [Model routing](/pipelines/routing): Send each Bento pipeline run to the right model with named routes, label-based routing, and credential pools.
- [Orchestration](/pipelines/orchestration): Let an orchestrator decide how to dispatch a Bento pipeline: run one agent, fan out in parallel, or call typed capabilities.
- [Retries and failover](/pipelines/retries-and-failover): How Bento keeps runs going: route failover, sandbox fallbacks, queue retries, and the circuit breaker.
- [Triggers](/triggers/): Start a Bento pipeline from a GitHub, Linear, webhook, schedule, or manual trigger. Compare the trigger types and when each one fires.
- [GitHub trigger](/triggers/github): Run a coding agent on GitHub pull request, issue, and other webhook events. Configure HMAC verification and event patterns.
- [Linear trigger](/triggers/linear): Run a coding agent on Linear issue and comment events. Configure the Linear webhook, signature verification, and Hookdeck relay.
- [Webhook trigger](/triggers/webhook): Fire a Bento pipeline from any HTTP POST to /webhooks/{name}, with bearer-token authentication declared in daemon.yaml.
- [Schedule trigger](/triggers/schedule)
- [Manual trigger](/triggers/manual): Fire any Bento pipeline on demand with bento pipeline fire, and pass typed inputs to a pipeline that runs only on request.
- [Traces](/pipelines/traces)
- [Slack](/integrations/slack)
- [Public access](/public-access): Expose the Bento daemon to GitHub webhooks through a Cloudflare Quick Tunnel or Tailscale Funnel, and compare the two options.
- [Context engineering](/context-engineering): Assemble each coding agent prompt from personas, policies, skills, and pipeline instructions. Learn which file each instruction belongs in.
- [Best practices](/best-practices)
- [Troubleshooting](/troubleshooting)
- [Architecture](/architecture/vision)
- [Workspaces](/workspaces)
- [Authentication](/authentication)
- [Identity](/identity)
- [Security](/security)
- [References](/references)
- [Changelog](/changelog): Bento release history.
- [CLI reference](/cli/)
- [Setup](/cli/setup)
- [Secrets](/cli/secrets)
- [Lifecycle](/cli/lifecycle)
- [Sandbox image](/cli/image)
- [Sandboxes](/cli/sandbox)
- [Observability](/cli/observability)
- [Diagnostics](/cli/diagnostics)
- [Pipeline](/cli/pipeline)
- [Events](/cli/events)
- [Workbench](/cli/workbench)
- [Auth](/cli/auth)
- [Knowledge](/cli/knowledge)
- [Evals](/cli/evals)
- [Bento docs: run coding agents from version-controlled pipelines](/index): Bento runs coding agents from pipelines you keep in your repository. Declare the trigger, sandbox, skill, and guardrails in YAML.
- [Runtime wrapper](/architecture/runtime-wrapper)
- [Skill evolve](/architecture/skill-evolve)
-->

# Model routing

A route is a named model configuration. It binds a runtime, a model, an optional reasoning effort, and a credential. A pipeline lists its routes in order, and Bento runs the agent on the first route that accepts the work.

Routes send each type of work to a suitable model. They also let you change a model in one location, and they continue a run when a provider refuses it.

## Define routes

Define routes in `daemon.yaml`:

```yaml
routes:
  claude-high:
    runtime: claude
    model: claude-opus-5-5
    effort: high
    credential_pool: [max-0x, max-1x, max-2x]
  claude-fast:
    runtime: claude
    model: claude-sonnet-5-5
    credential: max-0x
  codex-high:
    runtime: codex
    model: gpt-5.6-sol
    effort: high
    credential: oai-personal
    description: strong non-Claude route for a diverse second opinion on code
```

A route sets `credential` for one fixed credential, or `credential_pool` for an ordered list. A pool can mix subscription and API-key credentials. See the [routes registry](/configuration#routes) for all fields.

## Select routes in a pipeline

Each pipeline must declare `routes`. The first route is the primary route. Bento uses a later route only when the primary route refuses the work.

```yaml
agent: reviewer
routes: [codex-high, claude-high]
```

A pipeline with no `routes` field fails validation.

## Route by label

To select routes from a label on the pull request that started the run, use `routes_by_label`. This setting sends low-risk work to a fast model and high-risk work to a strong model.

```yaml
agent: reviewer
routes: [codex-high, claude-high] # default: no matching label
routes_by_label:
  tier:low: [claude-fast]
  tier:high: [claude-high, codex-high]
```

Bento uses the first key, in declaration order, that matches a label on the pull request. A pull request with no matching label uses `routes`. Bento has no built-in label names, so you can route on any label, such as `tier:*` or `priority:*`.

## Grade work, then route it

Bento does not decide the risk of work. One pipeline sets the label, and a second pipeline routes on it. To grade work and then route it, do the following:

1. Add a grader pipeline that reads each new pull request and sets a label such as `tier:low` or `tier:high`.
2. Add `routes_by_label` to the pipeline that does the work.

The grader is a pipeline, so you can read its prompt, change it in a pull request, and measure its results with [evals](/cli/evals).

## Compare routes

To compare routes on real work, use evals. The scorecard shows quality, response coverage, cost, and latency for each route.

```bash
bento evals scorecard --pipeline pr-review
```

To change a route, edit the pipeline file and restart the daemon.

## Route failure

When a route fails, Bento moves to the next route in the same run for some failures. For the rules, see [Retries and failover](/pipelines/retries-and-failover).
