← Back to PRs

#18695: feat(agents): add per-agent thinkingDefault override

by cathrynlavery open 2026-02-17 00:03 View on GitHub →
app: web-ui gateway commands agents stale size: S
## 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