Unclear It is not confirmed that setting this variable is what removes Sonnet and Haiku from the agent model choices.
What
A subagent is a helper Claude starts to work on part of a task, which can run on its own model. A new environment variable (a named setting a program receives at start), CLAUDE_CODE_SUBAGENT_NO_SMALL_MODELS, keeps subagents off the smaller Sonnet and Haiku models. It did not exist in v2.1.335.
- When it applies, choosing a subagent's model refuses Sonnet and Haiku and falls back to Opus or to the model the session inherited.
- If no such model is available, the subagent does not start, with the error 'The subagent was not started: no model larger than Sonnet is available for it.'
- It applies only in a certain kind of session or when
CLAUDE_CODE_PROVIDER_MANAGED_BY_HOSTis set. - The model choices offered for an agent leave out sonnet and haiku, with the note: "Sonnet and Haiku are not offered on this session: an agent that would run on one runs on a larger model, usually Opus."
- The variable is on Claude Code's list of variable names next to the other
CLAUDE_CODE_SUBAGENT_*variables,CLAUDE_CODE_REQUIRED_PLUGINS_HOLDandCLAUDE_CODE_GIT_CHECK_ONLY_IN_REPOSITORY.
Why
Programs that embed Claude Code can make sure subagents never quietly run on a small model, and see a clear error when no larger one is available.
Names in the bundleCLAUDE_CODE_SUBAGENT_NO_SMALL_MODELS
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubt
It is not confirmed that setting this variable is what removes Sonnet and Haiku from the agent model choices.