[BUG] Agent teams ignore ANTHROPIC_DEFAULT_*_MODEL env vars when using Azure AI Foundry
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?
When using Claude Code with Azure AI Foundry (CLAUDE_CODE_USE_FOUNDRY=1), spawned teammate agents in agent teams don't inherit the model configuration from environment variables. They use hardcoded Anthropic model IDs instead of the Azure AI Foundry deployment names.
Configuration:
export CLAUDE_CODE_USE_FOUNDRY=true
export ANTHROPIC_FOUNDRY_RESOURCE='my-azure-resource'
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-45-claude-custom' # Azure deployment name
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-opus-46-claude-custom'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-45-claude-custom'
Evidence from team config file (~/.claude/teams/{team-name}/config.json):
{
"members": [
{
"name": "team-lead",
"model": "claude-opus-45-claude-custom" // ✅ Correct - uses env var
},
{
"name": "test-agent",
"model": "claude-opus-4-6" // ❌ Wrong - hardcoded Anthropic API model ID
}
]
}
The team lead (main session) correctly uses the Azure AI Foundry deployment name from the environment variable, but spawned teammates get the hardcoded Anthropic API model ID (claude-opus-4-6) which doesn't exist on Azure AI Foundry.
What Should Happen?
Spawned teammate agents should inherit the model configuration from ANTHROPIC_DEFAULT_*_MODEL environment variables, just like the team lead does.
Error Messages/Logs
When the spawned agent tries to run:
There's an issue with the selected model (claude-opus-4-6). It may not exist or you may not have access to it. Run /model to pick a different model.
The agent goes idle repeatedly but cannot process any messages because the model is invalid.
Steps to Reproduce
- Configure Claude Code for Azure AI Foundry with custom deployment names:
``bash``
export CLAUDE_CODE_USE_FOUNDRY=true
export ANTHROPIC_FOUNDRY_RESOURCE='your-resource'
export ANTHROPIC_DEFAULT_OPUS_MODEL='your-custom-deployment-name'
- Start Claude Code - main session works correctly
- Create an agent team using
TeamCreate - Spawn a teammate agent using the
Tasktool withteam_nameparameter - Check the team config file - spawned agent has hardcoded
claude-opus-4-6instead of the env var value - Spawned agent cannot function because the model doesn't exist on Azure AI Foundry
Claude Model
Claude Opus 4.5
Is this a regression?
Not sure / Don't know
Last Working Version
_No response_
Claude Code Version
Latest (installed via npm)
Platform
Azure AI Foundry (Microsoft Foundry)
Operating System
Linux (WSL2)
Terminal/Shell
zsh
Additional Information
- The team lead correctly picks up
ANTHROPIC_DEFAULT_OPUS_MODELfrom the environment - Only spawned teammates (via Task tool with team_name) get the hardcoded model ID
- This makes agent teams completely unusable with Azure AI Foundry deployments that have custom names
- Tested with
modelparameter in settings.json as well - no effect on spawned agents
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗