[BUG] Agent teams ignore ANTHROPIC_DEFAULT_*_MODEL env vars when using Azure AI Foundry (changelog claims the opposite)
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
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.39
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
The changelog claims this was fixed, not for me:
<img width="791" height="193" alt="Image" src="https://github.com/user-attachments/assets/818f83ce-0ba3-4068-85d2-da4d485e5351" />
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗