[BUG] Agent teams ignore ANTHROPIC_DEFAULT_*_MODEL env vars when using Azure AI Foundry (changelog claims the opposite)

Resolved 💬 3 comments Opened Feb 11, 2026 by YounesAkh Closed Feb 15, 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

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" />

View original on GitHub ↗

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