# Agent Routing

The ways a request reaches an agent: automatic dispatch, the subagents tool, and external agents.

Two ways decide which agent handles a task:

**1. Automatic** — A dispatcher LLM analyzes the input and picks the best-fit provider via `ResolveAgent()`. Since v1.1.0 `pass`-tier models are never picked or used as fallbacks; a session pinned to a model still uses it.

Startup order: `exec.Prepare` (TUI-only exclusions, `/skill-name` match) → `exec.Start` (named skill resolution, agent resolution, session load) → `Execute`. A named skill that is excluded or not found fails the run.

The `:self-id` one-shot override prefix was removed; delegate to a named session with `subagents(self_id=...)`, or switch sessions with `/session`.

**2. `subagents` tool** — An agent calls another agent in-process (no HTTP) during execution, inheriting `AllowAll` and `WorkDir` from the parent ctx. Since v1.1.0 `mode=invoke` requires `model` — the dispatcher fallback for a blank model was dropped; pass `model: "auto"` (hotfix after v1.1.0) to let the dispatcher pick from the task — and the tier list the parent picks from in `reasoning_guide(topics=[subagent_dispatch])` starts one tier lower than for its own work (S → A, A → B, B → C). A `self_id` session pinned to its own model still runs that model; one left on `auto` runs the given one.

Subagents run under a **collection-only charter** — they gather and report, they don't nest or write. The exclusion set is built from three parts:

| Source | Excluded |
|---|---|
| Charter base | `subagents`, `edit_file`, `generate*` (wildcard) |
| TUI-only tools / skills | Whatever `configs/jsons/tui_tools.json` lists, e.g. `extension-upload`, `extension-install` |
| Caller's `exclude_tools` | Anything the parent passes in |

`ask_user` is **not** excluded — subagents can ask the user through the shared pending registry. A subagent's pending question is also published to the owning (parent) session, and the leg waits for that resume and returns the answered result. At most three subagent legs execute concurrently (`maxConcurrentSubagents`); a fourth waits for a slot while its own `MaxSubagentTimeoutMin` (30 min) timeout is already running, so wide fan-outs should be dispatched in batches of three. Each result carries a usage header that rolls up into the parent session's totals; since v1.0.22 the report itself is saved to `~/.config/agenvoy/download/temp-<report_name>.md` and only its path comes back.
