microsoft/semantic-kernel · error · AgentInitializationException

Agent type '{agent_type}' is not supported.

Error message

Agent type '{agent_type}' is not supported.

What it means

The dict-path counterpart of error 700: create_agent_from_dict found a 'type' value but it is not present in AGENT_TYPE_REGISTRY. Same cause (typo, unregistered custom type, missing optional dependency) but reached through the dict entry point instead of the YAML one.

Source

Thrown at python/semantic_kernel/agents/agent.py:815

        Returns:
            An instance of the requested agent.

        Raises:
            AgentInitializationException: If the dictionary is missing a 'type' field or the agent type is unsupported.

        Example:
            agent = await AgentRegistry.create_agent_from_dict(agent_data, kernel=kernel)
        """
        _preload_builtin_agents()

        agent_type = data.get("type", "").lower()

        if not agent_type:
            raise AgentInitializationException("Missing 'type' field in agent definition.")

        if agent_type not in AGENT_TYPE_REGISTRY:
            raise AgentInitializationException(f"Agent type '{agent_type}' is not supported.")

        agent_cls = AGENT_TYPE_REGISTRY[agent_type]

        if not isinstance(agent_cls, DeclarativeSpecProtocol):
            raise AgentInitializationException(
                f"Agent class '{agent_cls.__name__}' does not support declarative spec loading."
            )

        return await agent_cls.from_dict(
            data,
            kernel=kernel,
            plugins=plugins,
            settings=settings,
            extras=extras,
            **kwargs,
        )

    @staticmethod

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Print AGENT_TYPE_REGISTRY keys and align the dict's 'type' value to one of them (case-insensitive).
  2. Register the custom agent type before the call with AgentRegistry.register_type(type_str, cls).
  3. Install the optional package that registers the built-in type you expect.

Example fix

# before
await AgentRegistry.create_agent_from_dict({'type': 'azure_agent', 'name': 'a'}, kernel=kernel)

# after
await AgentRegistry.create_agent_from_dict({'type': 'azure_ai_agent', 'name': 'a'}, kernel=kernel)
Defensive patterns

Strategy: validation

Validate before calling

from semantic_kernel.agents.agent import AGENT_TYPE_REGISTRY, _preload_builtin_agents
_preload_builtin_agents()
assert data['type'].lower() in AGENT_TYPE_REGISTRY, f'Unknown type {data["type"]}; known {sorted(AGENT_TYPE_REGISTRY)}'

Type guard

def is_registered_agent_type(type_str: str) -> bool:
    _preload_builtin_agents()
    return isinstance(type_str, str) and type_str.lower() in AGENT_TYPE_REGISTRY

Try / catch

from semantic_kernel.exceptions.agent_exceptions import AgentInitializationException
try:
    agent = await AgentRegistry.create_agent_from_dict(data, kernel=kernel)
except AgentInitializationException as e:
    logger.error('Load failed: %s', e)
    raise

Prevention

When it happens

Trigger: Calling create_agent_from_dict with `{'type': 'azre_ai_agent', ...}` (typo) or a custom type string that was never registered via AgentRegistry.register_type / @register_agent_type.

Common situations: Mismatch between the type string in a persisted config and the version of Semantic Kernel that registered the built-ins; custom agent module not imported.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/343f067d57437f9b. Report an issue: GitHub.