{"record":{"id":"a6ed37ca089c7a3c","repo":"microsoft/semantic-kernel","slug":"unable-to-get-channel-keys-channel-type-not-confi","errorCode":null,"errorMessage":"Unable to get channel keys. Channel type not configured.","messagePattern":"Unable to get channel keys\\. Channel type not configured\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/agent.py","lineNumber":426,"sourceCode":"            kwargs: Additional keyword arguments.\n\n        Yields:\n            An agent response item.\n        \"\"\"\n        pass\n\n    # endregion\n\n    # region Channel Management\n\n    def get_channel_keys(self) -> Iterable[str]:\n        \"\"\"Get the channel keys.\n\n        Returns:\n            A list of channel keys.\n        \"\"\"\n        if not self.channel_type:\n            raise NotImplementedError(\"Unable to get channel keys. Channel type not configured.\")\n        yield self.channel_type.__name__\n\n    async def create_channel(self) -> AgentChannel:\n        \"\"\"Create a channel.\n\n        Returns:\n            An instance of AgentChannel.\n        \"\"\"\n        if not self.channel_type:\n            raise NotImplementedError(\"Unable to create channel. Channel type not configured.\")\n        return self.channel_type()\n\n    # endregion\n\n    # region Instructions Management\n\n    async def format_instructions(self, kernel: Kernel, arguments: KernelArguments | None = None) -> str | None:\n        \"\"\"Format the instructions.","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/agent.py#L408-L444","documentation":"Agent.get_channel_keys() yields the channel type's class name, but only if the subclass set the channel_type ClassVar. The base Agent leaves channel_type = None, so calling get_channel_keys on a base/incompletely-subclassed agent raises NotImplementedError. Every concrete agent must declare its channel_type to participate in agent chats.","triggerScenarios":"Instantiating the abstract Agent base directly (or a subclass that forgot to set channel_type) and adding it to an AgentGroupChat / chat, which calls get_channel_keys.","commonSituations":"Writing a custom agent subclass and omitting channel_type; instantiating Agent itself; subclassing a chat agent but not assigning a channel type.","solutions":["Use a concrete built-in agent (ChatCompletionAgent, OpenAIAssistantAgent, etc.) which already sets channel_type.","In a custom Agent subclass, set channel_type to an appropriate AgentChannel subclass (ClassVar[type[AgentChannel]]).","Do not instantiate the abstract Agent base directly."],"exampleFix":"# before\nclass MyAgent(Agent):\n    ...  # channel_type missing -> error\n# after\nfrom semantic_kernel.agents.channels.chat_history_channel import ChatHistoryChannel\nclass MyAgent(Agent):\n    channel_type: ClassVar[type[AgentChannel]] = ChatHistoryChannel","handlingStrategy":"type-guard","validationCode":"assert agent.channel_type is not None, \\\n    f'{type(agent).__name__} must set channel_type to participate in chats'","typeGuard":"from semantic_kernel.agents.channels.agent_channel import AgentChannel\ndef agent_has_channel(agent) -> bool:\n    return getattr(type(agent), 'channel_type', None) is not None and issubclass(type(agent).channel_type, AgentChannel)","tryCatchPattern":null,"preventionTips":["Set channel_type on every custom Agent subclass.","Use built-in concrete agents which configure channels.","Never instantiate the abstract Agent base.","Verify channel_type before adding an agent to a group chat."],"tags":["agents","channel","subclassing","semantic-kernel","not-implemented"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}