-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem: Subagents always run on the model configured at startup. There's no way for an orchestrating agent to switch models at runtime based on context.
Use cases:
- Adaptive review loop — orchestrator runs code review on haiku. If the same errors repeat twice, it escalates to sonnet or opus for a more thorough review (fewer false positives, better understanding of context).
- Variable-complexity reports — same report-generating subagent, but the orchestrator picks the model based on report difficulty. Simple report → cheap model. Complex/long report → stronger model. The agent definition stays the same.
Proposed approach: Add a model parameter to the task tool ("provider/model-id" format). Gate it with a new model_override permission (default: deny) so users control which models agents can switch to. Supports wildcards ("anthropic/*": "allow") and specific models.
Why permission-gated: Without it, a prompt injection could escalate to an expensive model, or an agent could pick models randomly. The permission system lets users whitelist exactly what's allowed.
Not a duplicate of #17570: That issue is about static config — users assign models to subagents upfront in config/UI. This is about runtime decisions — the orchestrating agent picks the model dynamically based on what's happening during execution (errors, complexity, retries). They're complementary features.
Note: PR #17577 with an implementation already exists — apologies for the reversed order. Opening this issue retroactively for proper tracking and design discussion.