{"record":{"id":"6a80b07c595fe2e0","repo":"microsoft/semantic-kernel","slug":"module-name-has-no-attribute-name","errorCode":null,"errorMessage":"module {__name__} has no attribute {name}","messagePattern":"module (.+?) has no attribute (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/__init__.py","lineNumber":62,"sourceCode":"    \"GroupChatOrchestration\": \".orchestration.group_chat\",\n    \"RoundRobinGroupChatManager\": \".orchestration.group_chat\",\n    \"BooleanResult\": \".orchestration.group_chat\",\n    \"StringResult\": \".orchestration.group_chat\",\n    \"MessageResult\": \".orchestration.group_chat\",\n    \"GroupChatManager\": \".orchestration.group_chat\",\n    \"MagenticOrchestration\": \".orchestration.magentic\",\n    \"ProgressLedger\": \".orchestration.magentic\",\n    \"MagenticManagerBase\": \".orchestration.magentic\",\n    \"StandardMagenticManager\": \".orchestration.magentic\",\n}\n\n\ndef __getattr__(name: str):\n    if name in _AGENTS:\n        submod_name = _AGENTS[name]\n        module = importlib.import_module(submod_name, package=__name__)\n        return getattr(module, name)\n    raise AttributeError(f\"module {__name__} has no attribute {name}\")\n\n\ndef __dir__():\n    return list(_AGENTS.keys())\n","sourceCodeStart":44,"sourceCodeEnd":67,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/__init__.py#L44-L67","documentation":"The semantic_kernel.agents package uses lazy importing: __getattr__ resolves names listed in the _AGENTS dict on first access. Accessing any attribute not in that dict raises AttributeError with this message. It is purely an import/name-resolution error, usually a typo or an attempt to import a private/un-exported symbol.","triggerScenarios":"from semantic_kernel.agents import SomeMisspelledName; accessing a submodule/symbol that exists in the package but isn't registered in _AGENTS; importing before the package is fully installed (missing optional dep hiding the real symbol).","commonSituations":"Typo in a class name (e.g. ChatCompletionAgent misspelled); expecting an agent class that requires an optional dependency that isn't installed; using an older/newer SDK version where the export name differs.","solutions":["Check the spelling against the _AGENTS dict in semantic_kernel/agents/__init__.py (it lists every exported name).","Install the optional dependencies for the agent you want (e.g. openai/azure extras) — a missing dep can prevent the name from being registered.","Confirm you are on a SDK version that exports the symbol; check the changelog/release notes.","Import the concrete module path directly if the top-level alias is unavailable (e.g. from semantic_kernel.agents.open_ai import OpenAIAssistantAgent)."],"exampleFix":"# before\nfrom semantic_kernel.agents import ChatCompletionAgnet  # typo\n# after\nfrom semantic_kernel.agents import ChatCompletionAgent","handlingStrategy":"validation","validationCode":"import semantic_kernel.agents as a\nname = 'ChatCompletionAgent'\nassert name in a.__dir__(), f'{name} is not an exported agents attribute; check spelling/version'","typeGuard":"import semantic_kernel.agents as _a\ndef is_exported_agent(name: str) -> bool:\n    return name in _a.__dir__()","tryCatchPattern":"try:\n    from semantic_kernel.agents import ChatCompletionAgent\nexcept AttributeError as e:\n    # fall back to the concrete module path or install missing extras\n    from semantic_kernel.agents.chat_completion.chat_completion_agent import ChatCompletionAgent","preventionTips":["Cross-check names against the _AGENTS dict in agents/__init__.py.","Install the optional extras for the agent you need.","Pin a compatible SDK version.","Import concrete module paths as a fallback."],"tags":["agents","import","semantic-kernel","lazy-import","attribute-error"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}