Skip to main content

Module subagent_model

Module subagent_model 

Source
Expand description

Which model a Claude agent’s sub-agents run on (SPEC_SUBAGENT_MODELS_2026_10_25.md). Which model a Claude agent’s sub-agents run on (docs/specs/SPEC_SUBAGENT_MODELS_2026_10_25.md).

Sub-agents were about a quarter of the fleet’s spend and almost all of their calls ran on the biggest model, because a sub-agent inherits its parent’s model. Measured on Claude Code 2.1.288:

  • CLAUDE_CODE_SUBAGENT_MODEL moves general-purpose sub-agents (and custom ones with no model of their own). It is set at spawn from [SETTING_SUBAGENT], or the pane’s own [META_SUBAGENT]. Without ..._FORCE, an agent’s own model: and the model its parent passes per call still win, so a leader can send a hard question to Opus.
  • Explore and Plan ignore it and stay on the parent’s model. Explore is moved by a user-level agent definition named Explore in the Claude config dir, which beats the built-in: AgentMux writes one ([seed_explore_agent]) from [SETTING_EXPLORE] and removes it again when the setting says inherit. One a person wrote is left alone.

Constants§

DEFAULT_EXPLORE_MODEL
DEFAULT_SUBAGENT_MODEL
META_SUBAGENT
Block meta that overrides SETTING_SUBAGENT for one agent.
SETTING_EXPLORE
agent:exploremodel: the model for Explore sub-agents.
SETTING_SUBAGENT
agent:subagentmodel: the model for general-purpose sub-agents.

Functions§

carry
Add CLAUDE_CODE_SUBAGENT_MODEL to a Claude agent’s spawn environment, unless its cmd:env already sets one. Not for other providers.
explore_model
SETTING_EXPLORE now, resolved: the model to write, or None for none.
resolve
The model to set, the first level that says something: the pane’s own, then the setting, then the default. None when it says inherit.
seed_explore_agent
Write, or remove, the Explore definition in config_dir’s agents/ folder for model (None removes AgentMux’s own). Leaves one a person wrote. Returns whether the file changed.