microsoft/autogen · error · ImportError

Dependencies for AzureAIAgent not found. Please install auto

Error message

Dependencies for AzureAIAgent not found. Please install autogen-ext with the "azure" extra: pip install "autogen-ext[azure]"

What it means

ImportError raised at import time of autogen_ext.agents.azure when the optional Azure AI Projects SDK dependencies are missing. autogen-ext ships extras; the 'azure' extra installs the azure-ai-projects / azure-identity packages that _azure_ai_agent.py imports. The original ImportError is chained (from e), so the real missing module appears in the traceback cause.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/agents/azure/__init__.py:4

try:
    from ._azure_ai_agent import AzureAIAgent
except ImportError as e:
    raise ImportError(
        "Dependencies for AzureAIAgent not found. "
        'Please install autogen-ext with the "azure" extra: '
        'pip install "autogen-ext[azure]"'
    ) from e

__all__ = ["AzureAIAgent"]

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Install the extra: pip install "autogen-ext[azure]"
  2. Pin it in requirements.txt/pyproject: autogen-ext[azure]>=<version> so CI and teammates get it.
  3. Verify with python -c "import azure.ai.projects" — if that fails, the underlying SDK is what's missing.
  4. If it still fails after install, check the chained ImportError cause for a conflicting/broken azure package version and reinstall it.

Example fix

# before
pip install autogen-ext
# after
pip install "autogen-ext[azure]"
Defensive patterns

Strategy: validation

Validate before calling

def azure_extra_available() -> bool:
    try:
        import azure.ai.projects  # noqa
        return True
    except ImportError:
        return False

if not azure_extra_available():
    raise SystemExit('Run: pip install "autogen-ext[azure]"')

Try / catch

try:
    from autogen_ext.agents.azure import AzureAIAgent
except ImportError as e:
    print(e)  # includes the pip install "autogen-ext[azure]" hint
    raise SystemExit(1)

Prevention

When it happens

Trigger: `from autogen_ext.agents.azure import AzureAIAgent` (or any import path touching autogen_ext.agents.azure) in an environment where autogen-ext was installed without the [azure] extra.

Common situations: Fresh venv with plain `pip install autogen-ext`; CI caches that prune extras; dependency resolvers/downgraders that reinstall autogen-ext without extras; mixing conda and pip installs.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/f44b51ccc3f0892f. Report an issue: GitHub.