Agent Teams: Support per-teammate model configuration

Status Closed — not planned
Maintainer reply None cached
Activity 11 comments · opened Mar 8, 2026 · closed May 1, 2026

Feature Request

Problem

When using Agent Teams (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS), there is no way to specify different models for individual teammates. All teammates unconditionally inherit the team lead's model (e.g., Opus), regardless of any configuration attempt.

What I've Tried

| Method | Result |
|--------|--------|
| Agent file frontmatter model: sonnet | ❌ Ignored in Teams (works for standalone sub-agents) |
| Natural language "Use Sonnet for each teammate" | ❌ Ignored |
| Full model ID claude-sonnet-4-6 in frontmatter | ❌ Ignored |
| Environment variable CLAUDE_CODE_SUBAGENT_MODEL=sonnet via Bash export | ❌ Not passed to Agent Teams process |
| Environment variable in ~/.claude/settings.json env | ❌ Works for standalone sub-agents, ignored in Agent Teams |

Expected Behavior

Ability to specify per-teammate models in Agent Teams, similar to how standalone sub-agents support the model field in .claude/agents/*.md frontmatter.

Use Case

Running a mixed-model team for cost optimization:

  • Opus for complex roles (tech-lead, PM) requiring deep reasoning
  • Sonnet for execution-heavy roles (frontend-dev, backend-dev, infra, QA, designer)

This would significantly reduce API costs while maintaining quality where it matters most.

Suggested Solutions (any of these would work)

  1. Add a model parameter to the Agent tool when spawning teammates
  2. Respect the model frontmatter in custom agent files (.claude/agents/*.md) when used in Teams
  3. Add a Teams-specific environment variable (e.g., CLAUDE_CODE_AGENT_TEAMS_DEFAULT_MODEL)

Environment

  • Claude Code version: latest
  • Feature flag: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
  • OS: macOS

View original on GitHub ↗

11 Comments

github-actions[bot] · 5 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/31430
  2. https://github.com/anthropics/claude-code/issues/31027

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

MasterXue · 5 months ago

https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2172

  • Fixed team agents to inherit the leader's model

2.1.72 fix the bug, but I haven't verified it yet.

MasterXue · 5 months ago
https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2172 * Fixed team agents to inherit the leader's model 2.1.72 fix the bug, but I haven't verified it yet.

I tested it and I'm sure it didn't fix it.

MasterXue · 5 months ago

v2.1.74 maybe fix it, i tested it

it235 · 5 months ago
v2.1.74 maybe fix it, i tested it

Bro, I still have a problem here. Are you sure you have fixed it? Does teammate inherit the lead model

MasterXue · 5 months ago
> v2.1.74 maybe fix it, i tested it Bro, I still have a problem here. Are you sure you have fixed it? Does teammate inherit the lead model

Indeed, someone have reported that there are still problems, and I need to check it again.

MasterXue · 5 months ago
> v2.1.74 maybe fix it, i tested it Bro, I still have a problem here. Are you sure you have fixed it? Does teammate inherit the lead model

i am sure, it not works

East-rayyy · 5 months ago

@kodlong — I ran into the same frustration with per-teammate model config. I built claude-alias-patch which patches Claude Code to support custom model aliases beyond sonnet/opus/haiku.

You define aliases via env vars like ANTHROPIC_DEFAULT_GEMINI_MODEL, ANTHROPIC_DEFAULT_GPT_MODEL, etc. in ~/.claude/settings.json. The patch makes them available in the Agent tool's model parameter, agent frontmatter, and the model picker — so you can assign different models to different teammates.

It's a single install script that auto-patches your Claude instance. No need to re-patch when you change models — just edit settings and restart.

yurukusa · 5 months ago

Until native per-teammate model configuration is supported, you can use a PreToolUse hook on the Agent tool to inject model preferences:

INPUT=$(cat)
TEAM=$(echo "$INPUT" | jq -r '.tool_input.team_name // empty' 2>/dev/null)
NAME=$(echo "$INPUT" | jq -r '.tool_input.name // empty' 2>/dev/null)
PROMPT=$(echo "$INPUT" | jq -r '.tool_input.prompt // empty' 2>/dev/null)
MODEL=""
case "$NAME" in
    researcher|explorer) MODEL="sonnet" ;;
    implementer|coder) MODEL="opus" ;;
    reviewer|tester) MODEL="haiku" ;;
esac
if [ -n "$MODEL" ]; then
    echo "{\"hookSpecificOutput\":{\"additionalContext\":\"IMPORTANT: Use the $MODEL model for this task. You are a $NAME teammate.\"}}"
fi
exit 0

Since standalone agents respect the model frontmatter, you can emulate teams with individual agent spawns:

<!-- .claude/agents/researcher.md -->
---
model: sonnet
---
Research agent. Uses Sonnet for cost efficiency.
<!-- .claude/agents/implementer.md -->
---
model: opus
---
Implementation agent. Uses Opus for complex code.

Then use Agent tool with subagent_type pointing to specific agents instead of team_name.

{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Agent",
      "hooks": [{ "type": "command", "command": "bash ~/.claude/hooks/team-model-router.sh" }]
    }]
  }
}

The hook can also log which model each teammate should use, helping you track costs per teammate role.

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.