#18695: feat(agents): add per-agent thinkingDefault override
app: web-ui
gateway
commands
agents
stale
size: S
Cluster:
Agent Thinking Defaults Enhancement
## Summary
Adds a `thinkingDefault` field to per-agent config (`agents.list[].thinkingDefault`) so each agent can have its own default thinking/reasoning level, independent of which model it runs.
**Use case:** A research agent should think deeply (`xhigh`) while a simple chat agent should stay fast (`minimal`) — even if both use the same model. Previously, thinking level could only be set globally or per-model, not per-agent.
This builds on the recently-merged per-model `thinkingDefault` support, extending the resolution chain to a 4-tier priority:
1. **Per-agent** (`agents.list[].thinkingDefault`) — highest priority ← **this PR**
2. **Per-model** (`agents.defaults.models[].thinkingDefault`) — already in main
3. **Global** (`agents.defaults.thinkingDefault`) — already in main
4. **Catalog auto-detect** (reasoning-capable models default to `"low"`) — already in main
All 3 call sites (gateway chat, CLI agent command, auto-reply) now correctly source per-agent config via `resolveAgentConfig()` instead of reading from global defaults.
## Example config
```yaml
agents:
defaults:
thinkingDefault: low # tier 3: global fallback
models:
openai-codex/gpt-5.3-codex:
thinkingDefault: high # tier 2: per-model default
list:
- id: research
thinkingDefault: xhigh # tier 1: this agent always thinks deeply
- id: chat
thinkingDefault: minimal # tier 1: this agent stays fast
```
## Changes
- `agents/agent-scope.ts` — wire `thinkingDefault` through `ResolvedAgentConfig`
- `agents/model-selection.ts` — add `agentThinkingDefault` param to `resolveThinkingDefault()` as tier 1
- `commands/agent.ts` — use `resolveAgentConfig()` for per-agent thinking default
- `auto-reply/reply/get-reply-directives.ts` — pass per-agent thinkingDefault to model selection
- `auto-reply/reply/model-selection.ts` — accept `agentThinkingDefault` param
- `gateway/server-methods/chat.ts` — pass per-agent thinkingDefault from resolved agent config
- `config/types.agents.ts`, `zod-schema.agent-runtime.ts` — add `thinkingDefault` to agent entry schema
## Test plan
- [x] Unit tests for `resolveThinkingDefault` 4-tier priority (5 tests)
- [x] Schema validation tests for `agents.list[].thinkingDefault` (2 tests)
- [x] Existing `agent.test.ts` and `model-selection.inherit-parent.test.ts` pass
- [x] TypeScript type check passes
- [x] Lint passes (oxlint)
Most Similar PRs
#15030: Agents: support per-agent thinking defaults
by sauerdaniel · 2026-02-12
87.4%
#21959: feat(config): add per-agent thinkingDefault, heartbeat thinking ove...
by heyhudson · 2026-02-20
86.9%
#16899: feat(config): per-agent and per-model thinking defaults
by jh280722 · 2026-02-15
86.7%
#21558: config: support agents.list[].thinkingDefault
by Uarmagan · 2026-02-20
83.8%
#20458: feat: per-model thinkingDefault config and /think default directive
by kmixter · 2026-02-18
79.6%
#14474: feat(config): add agents.defaults.reasoningDefault for default reas...
by lailoo · 2026-02-12
75.5%
#16399: feat: auto-escalate thinking level based on context window usage
by cmfinlan · 2026-02-14
73.7%
#16298: feat(xai): switch grok-4-1-fast variants by thinking level
by avirweb · 2026-02-14
70.7%
#19329: feat: add per-agent compaction and context pruning overrides
by curtismercier · 2026-02-17
69.2%
#14323: feat: add forcePrependThinkTag option for reasoning models
by LisaMacintosh · 2026-02-11
68.6%