[BUG] Subagent model override (frontmatter + Agent tool param) is silently inoperative

Resolved 💬 3 comments Opened Apr 28, 2026 by uc-michaelwu Closed May 2, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code documents two ways to set a subagent's model:

model: field in agent definition frontmatter (.claude/agents/<name>.md)
model parameter on the Agent tool call
Empirically, neither controls actual model routing. Subagents always inherit the parent session's model. The model parameter on the Agent tool call is recorded in the request log but does not change which model the subagent's API calls use.

This is a silent failure: the agent self-reports the configured model in conversation ("I am running on Claude Opus 4.7"), but inference goes to the parent's model.

What Should Happen?

Per the Agent tool schema:

model: Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent.

A subagent defined with model: opus in frontmatter, or invoked via Agent with model: "opus", should make its API calls to the Opus model. The parent session's model should not matter.

Error Messages/Logs

Subagents always make API calls to the parent session's model, regardless of frontmatter or Agent tool model parameter.

Across multiple subagent sessions where the Agent tool was invoked with explicit model: "opus":

subagent session A: 26 claude-sonnet-4-6, 1 sonnet (tool param record)
subagent session B: 94 claude-sonnet-4-6, 1 opus (tool param record, not inference), 1 <synthetic>
subagent session C: 34 claude-sonnet-4-6
100% of actual inference calls went to Sonnet, despite both frontmatter and explicit Agent tool param requesting Opus.

Steps to Reproduce

  1. Set the parent Claude Code session to Sonnet (e.g. claude-sonnet-4-6).
  2. Define a subagent in .claude/agents/test-opus.md with model: opus in frontmatter.
  3. Invoke it via the Agent tool, additionally passing model: "opus" in the tool call.
  4. Ask the subagent to identify itself — it will reply "I am running on Claude Opus 4.7" (because that's the configured intent it sees in its prompt context).
  5. Inspect the subagent's session JSONL at ~/.claude/projects/<project>/<subagent-uuid>.jsonl. Filter actual API call records with grep -o '"model":"[^"]*"' <subagent>.jsonl | sort | uniq -c.
  6. Observed: every assistant inference record uses the parent's model (claude-sonnet-4-6), not Opus. The only "model":"opus" entry is from the Agent tool call request payload, not from any inference response.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.119

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Impact
This breaks the documented multi-model orchestration pattern, where users want:

advisor / critic on Opus (reasoning-heavy planning + adversarial review)
implementer on Sonnet (cost + speed for execution)
The current workaround is for the user to manually run /model to switch the parent session before each subagent invocation. This is fragile and easy to forget.

It also creates a misleading developer experience: agents truthfully report their configured model based on prompt context, but inference happens elsewhere. Users investigating quality issues have no in-product signal that the intended model isn't actually running.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗