[BUG] Agent teams ignore ANTHROPIC_DEFAULT_*_MODEL env vars when using Azure AI Foundry

Resolved 💬 2 comments Opened Feb 6, 2026 by YounesAkh Closed Feb 11, 2026

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

  1. 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'
``

  1. Start Claude Code - main session works correctly
  2. Create an agent team using TeamCreate
  3. Spawn a teammate agent using the Task tool with team_name parameter
  4. Check the team config file - spawned agent has hardcoded claude-opus-4-6 instead of the env var value
  5. 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_MODEL from 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 model parameter in settings.json as well - no effect on spawned agents

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗