microsoft/autogen · error · ImportError

Dependencies for MagenticOneCoderAgent not found. Please ins

Error message

Dependencies for MagenticOneCoderAgent not found. Please install autogen-ext with the "magentic-one" extra: pip install "autogen-ext[magentic-one]"

What it means

autogen_ext.agents.magentic_one wraps its internal import of MagenticOneCoderAgent in a try/except ImportError and re-raises with an actionable message. The underlying import fails because optional dependencies (e.g. the tokenizer/models MagenticOne needs) are not installed; the package expects them via the 'magentic-one' extra of autogen-ext.

Source

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

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

__all__ = ["MagenticOneCoderAgent"]

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Install the extra: pip install "autogen-ext[magentic-one]" (add [magentic-one] to the dependency pin in pyproject/requirements).
  2. Verify the install with pip show autogen-ext and try importing a transitive dependency to confirm it now resolves.
  3. If it still fails after installing, check the chained exception (`raise ... from e`) — the original ImportError names the exact missing module; install that module directly to diagnose a version mismatch.

Example fix

# before (shell)
pip install autogen-ext

# after
pip install "autogen-ext[magentic-one]"
Defensive patterns

Strategy: try-catch

Validate before calling

# shell precheck
# pip show autogen-ext && python -c "import autogen_ext.agents.magentic_one"

Try / catch

try:
    from autogen_ext.agents.magentic_one import MagenticOneCoderAgent
except ImportError as e:
    log.error("magentic-one extra missing: %s", e)
    raise SystemExit("pip install 'autogen-ext[magentic-one]'")

Prevention

When it happens

Trigger: importing autogen_ext.agents.magentic_one (or constructing MagenticOneCoderAgent) in an environment where autogen-ext was installed without the [magentic-one] extra, so a transitive dependency is missing.

Common situations: pip install autogen-ext (bare, no extras) followed by using MagenticOne; CI caches that strip extras; upgrading autogen-ext and losing the previously-installed extra; conda environments where extras were never installed.

Related errors


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