# Teams and routing

URL: https://codepanel.ai/docs/teams-and-routing

Group coding agents into teams and route subtasks by measured track record or a routing.json task-class table with automatic escalation.

A CodePanel team groups several coding agents across different roles and models and routes each task or subtask automatically using each member's measured track record on the repository or an explicit `routing.json` table. Cheap models handle routine work first, and stronger models take over automatically when checks fail, reviews block, or runs stall.

## Routing by measured record

Every completed run updates its agent's record on that repository (first-try pass rate, cost per task, and time). When you start a thread with **Auto** or assign a team to an [Autopilot rule](/docs/autopilot), CodePanel routes work to the member whose measured record clears the routing bar at the lowest cost.

- Routing bars require a minimum sample size (`minN = 8`) and a first-try lower bound of 0.5 before trusting a member's record.
- Inspect every agent's record from MCP ([`get_agent_records`](/docs/mcp-server/get_agent_records)) or the CLI (`codepanel records`).

## Task-class routing tables (`routing.json`)

For teams that want deterministic model selection by task kind, a repository checkout can point to a `routing.json` file in its runner contract (`"routing": "agents/routing.json"`):

```json
{
  "measured": "2026-11-19 coding benchmark + repo history",
  "classes": {
    "light_code": {
      "first": "workers-ai/@cf/zai-org/glm-5.3-flash",
      "escalation": "anthropic/claude-sonnet-5-5",
      "dataSafe": "anthropic/claude-sonnet-5-5"
    }
  }
}
```

Supported task classes: `search_summary`, `docs_copy`, `tests`, `light_code`, `full_code`, `root_cause`, `review_verdict`, and `design`.

- **First model:** Each subtask starts on the team member running `first` for its class.
- **Escalation:** After a failed check, a blocked review, or a stall, the subtask moves to the member running `escalation`.
- **Data-safe model:** When a run holds production read MCP tools, it uses `dataSafe` instead of `first` so production data stays inside approved zero-retention providers.
- **Protected paths:** Paths listed in `protectedPaths` (such as billing or auth) never fall back to a cheaper member when a gateway spend limit hits; the run stops and asks instead.

Read how we measure cost per solved task across models in the [Coding agent benchmark](/benchmarks/coding) and manage teams with [`create_team`](/docs/mcp-server/create_team) and [`set_team_routing`](/docs/mcp-server/set_team_routing).
