{"record":{"id":"bfb0bebe018cc2de","repo":"microsoft/semantic-kernel","slug":"unsupported-agent-type-agenttype-bfb0be","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/Program.cs","lineNumber":52,"sourceCode":"    .AddEnvironmentVariables()\n    .AddUserSecrets<Program>()\n    .Build();\n\nstring? apiKey = configuration[\"A2AServer:ApiKey\"];\nstring? endpoint = configuration[\"A2AServer:Endpoint\"];\nstring modelId = configuration[\"A2AServer:ModelId\"] ?? \"gpt-4o-mini\";\n\nIEnumerable<KernelPlugin> invoicePlugins = [KernelPluginFactory.CreateFromType<InvoiceQueryPlugin>()];\n\nA2AHostAgent? hostAgent = null;\nif (!string.IsNullOrEmpty(endpoint) && !string.IsNullOrEmpty(agentId))\n{\n    hostAgent = agentType.ToUpperInvariant() switch\n    {\n        \"INVOICE\" => await HostAgentFactory.CreateFoundryHostAgentAsync(agentType, modelId, endpoint, agentId, invoicePlugins),\n        \"POLICY\" => await HostAgentFactory.CreateFoundryHostAgentAsync(agentType, modelId, endpoint, agentId),\n        \"LOGISTICS\" => await HostAgentFactory.CreateFoundryHostAgentAsync(agentType, modelId, endpoint, agentId),\n        _ => throw new ArgumentException($\"Unsupported agent type: {agentType}\"),\n    };\n}\nelse if (!string.IsNullOrEmpty(apiKey))\n{\n    hostAgent = agentType.ToUpperInvariant() switch\n    {\n        \"INVOICE\" => await HostAgentFactory.CreateChatCompletionHostAgentAsync(\n            agentType, modelId, apiKey, \"InvoiceAgent\",\n            \"\"\"\n            You specialize in handling queries related to invoices.\n            \"\"\", invoicePlugins),\n        \"POLICY\" => await HostAgentFactory.CreateChatCompletionHostAgentAsync(\n            agentType, modelId, apiKey, \"PolicyAgent\",\n            \"\"\"\n            You specialize in handling queries related to policies and customer communications.\n            \n            Always reply with exactly this text:\n            ","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/samples/Demos/A2AClientServer/A2AServer/Program.cs#L34-L70","documentation":"Error \"Unsupported agent type: {agentType}\" thrown in microsoft/semantic-kernel.","triggerScenarios":"Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/Program.cs:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a supported agent type via configuration or command line; review Program.cs for the list of valid values.","Fix typos in the agent type value so it matches a supported type exactly."],"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"}