# Dispatcher Model

How the dispatcher LLM picks the worker model and reasoning level for each task.

The dispatcher LLM decides which worker model handles each task. It runs in `exec.Run` through `exec/model.Route` → `selectWithLLM` (raced against `selectWithDecision` whenever a decision model is set, the first valid answer winning — see [Decision Model Dispatch](/providers-typesafe-dispatch); the `dispatcher_beta` switch that gated this was Removed in v1.3.2; the TypeSafe `selectWithJev` path was Removed in v1.3.1), before `Execute()` enters its iteration loop, receiving the registered model list, every registered model grouped by its resolved tier (user-set tier first, then the naming rules), the work-kind table below, the user input, and a hint about any matched skill. Its routing call is issued at `ReasoningNone` with a 30-second timeout.

Routing is skipped when it cannot matter: a model named explicitly by the caller is used as-is (and fails if unregistered), a session bound to a model other than `auto` uses that model, and a registry with only one selectable model returns it directly. In these cases the selector is still called when the session's reasoning is `auto`, but only for the reasoning level.

The dispatcher answers with the work kind on its first line and a comma-separated list of model names on the second (since v1.1.0), so the work kind also sets the reasoning level for sessions whose reasoning is `auto` — no decision model needed. The first name that is registered, not `pass` and not cooling down becomes the primary model. Since v1.0.20 the rest of that list no longer decides fallback — fallback follows the priority order (see [Model Priority and Tiers](/providers-routing-tiers)). It classifies the request into one of the five work kinds in the table on the [Decision Model Dispatch](/providers-typesafe-dispatch) page and walks that kind's tier order. Since v1.0.21 the LLM dispatcher, the decision-model dispatcher (the TypeSafe classifier before v1.3.1) and the subagent planner read one shared work-kind table (`internal/session/config/tier.go`) and one naming rule, so they rank the same way; before that the LLM dispatcher had no `research` / `work` split and sent everything outside code, chat and fetch to S > A > B > C. The dispatcher is told never to return a `pass` model, and a `pass` name it returns anyway is dropped (before v1.1.0 a request could still name one). Inside a tier, models on the subscription providers `claude-code` and then `codex` rank ahead of every other provider. When the same base model is registered under several providers, the list prefers `claude-code`, then `codex` / `grok` / `agy` (`agy` since v1.6.0; `grok` was `grok-oauth` before v1.6.0), then `copilot`, then the direct API, then `openrouter`. The `subagent_dispatch` topic of `reasoning_guide` gives the main agent the same table one tier lower (S→A, A→B, B→C) as a reference for each leg's `model`, so a leg of `code` work reads A > B > C > S. If the dispatcher call fails, the next dispatcher candidate is chosen by a fixed provider ranking; if none answers, the priority order alone decides.

Grok text models (every `grok-*` model except the `imagine` image models) carry xAI's server-side `x_search` tool on every request that has tools, so they search X posts, accounts and threads themselves (billed by xAI per post and profile fetched). When such a `grok` or `xai` model is registered and not `pass` (`grok-oauth` and `grok` before v1.6.0), the dispatcher prompt also puts it first for any request about X, whatever the kind of work (since v1.3.13).

Since v1.6.0 the same applies to web search: when an `agy` model is registered and not `pass`, the dispatcher prompt puts the `agy` models first for any request that needs a web search (recent news, releases, prices, docs, anything looked up online) and is not about X, whatever the kind of work, since they search the web natively.

Set the dispatcher with `/model` → `dispatch` in the TUI, or `POST /v1/model` with a `dispatcher` field.

Since v1.3.3 the dispatcher model also writes the one-sentence explanation shown on `run_command` / `background_command` confirmations: one call at `ReasoningNone` per prompt actually shown (read-only commands never ask), carrying only the request and the call, with no session history and nothing added to it, a 10-second limit, and the answer cut to 240 characters. Without a dispatcher model, or when the call fails, the prompt has no explanation.
