{"record":{"id":"4d1c013ef59adf02","repo":"microsoft/semantic-kernel","slug":"unsupported-agent-type-agenttype","errorCode":null,"errorMessage":"Unsupported agent type: {agentType}","messagePattern":"Unsupported agent type: (.+?)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/samples/Demos/A2AClientServer/A2AServer/HostAgentFactory.cs","lineNumber":27,"sourceCode":"using Microsoft.SemanticKernel.Agents.AzureAI;\n\nnamespace A2AServer;\n\ninternal static class HostAgentFactory\n{\n    internal static async Task<A2AHostAgent> CreateFoundryHostAgentAsync(string agentType, string modelId, string endpoint, string assistantId, IEnumerable<KernelPlugin>? plugins = null)\n    {\n        var agentsClient = new PersistentAgentsClient(endpoint, new AzureCliCredential());\n        PersistentAgent definition = await agentsClient.Administration.GetAgentAsync(assistantId);\n\n        var agent = new AzureAIAgent(definition, agentsClient, plugins);\n\n        AgentCard agentCard = agentType.ToUpperInvariant() switch\n        {\n            \"INVOICE\" => GetInvoiceAgentCard(),\n            \"POLICY\" => GetPolicyAgentCard(),\n            \"LOGISTICS\" => GetLogisticsAgentCard(),\n            _ => throw new ArgumentException($\"Unsupported agent type: {agentType}\"),\n        };\n\n        return new A2AHostAgent(agent, agentCard);\n    }\n\n    internal static async Task<A2AHostAgent> CreateChatCompletionHostAgentAsync(string agentType, string modelId, string apiKey, string name, string instructions, IEnumerable<KernelPlugin>? plugins = null)\n    {\n        var builder = Kernel.CreateBuilder();\n        builder.AddOpenAIChatCompletion(modelId, apiKey);\n        if (plugins is not null)\n        {\n            foreach (var plugin in plugins)\n            {\n                builder.Plugins.Add(plugin);\n            }\n        }\n        var kernel = builder.Build();\n","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/samples/Demos/A2AClientServer/A2AServer/HostAgentFactory.cs#L9-L45","documentation":"Error \"Unsupported agent type: {agentType}\" thrown in microsoft/semantic-kernel.","triggerScenarios":"Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/HostAgentFactory.cs:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported agent type strings accepted by HostAgentFactory (check the factory's switch/case for valid values).","If a new agent type is needed, extend HostAgentFactory with a branch for that type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}