Model Roles
Model roles let you assign different LLM models to different task types. The primary reasoning model handles user-facing conversations, while a cheaper utility model handles background tasks like compaction, memory flushing, and heartbeat checks.Architecture
The model roles system has three layers:- Configuration —
agents.defaults.model.rolesmaps role names to provider/model pairs - Classification — each LLM call site declares a fixed task type; the classifier maps it to a role
- Routing — the model router resolves the role to a concrete provider/model pair
Task Types
| Task Type | Role | Description |
|---|---|---|
reasoning | reasoning | User-facing agent turns (chat, cron jobs, followup) |
compaction | utility | Context window compaction (summarization) |
memory-flush | utility | Memory indexing and flush operations |
heartbeat | utility | Periodic heartbeat checks |
llm-task | utility | Generic LLM tasks from plugins |
Configuration
Add theroles key under agents.defaults.model in your config:
String shorthand
Object form with params
Both roles configured
Fallback Behavior
When a role is not configured or references an invalid model, the system falls back to the primary reasoning model (agents.defaults.model.primary):
- No
roleskey — all tasks use the primary model (zero-config backward compatible) - Empty
roles: {}— same as no roles; all tasks use primary - Invalid model reference — falls back to primary (e.g.
"invalid-no-slash") - Utility not configured — utility tasks use the primary model
- Reasoning not configured — reasoning tasks always use the primary model
Rate Limiting
When per-provider rate limiting is enabled, the model router passes the resolved role as a label to the rate limiter middleware. This provides per-role visibility in rate limit logs:Related
- Models — model catalog and configuration
- Model Selection — how models are selected for agent turns
- Model Failover — fallback chains when models are unavailable
- ADR-0006: 4-Model Role Architecture — architecture decision record
