microsoft/semantic-kernel · error · ArgumentException
Unsupported agent type: {agentType}
Error message
Unsupported agent type: {agentType} What it means
Error "Unsupported agent type: {agentType}" thrown in microsoft/semantic-kernel.
Source
Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/Program.cs:52
.AddEnvironmentVariables()
.AddUserSecrets<Program>()
.Build();
string? apiKey = configuration["A2AServer:ApiKey"];
string? endpoint = configuration["A2AServer:Endpoint"];
string modelId = configuration["A2AServer:ModelId"] ?? "gpt-4o-mini";
IEnumerable<KernelPlugin> invoicePlugins = [KernelPluginFactory.CreateFromType<InvoiceQueryPlugin>()];
A2AHostAgent? hostAgent = null;
if (!string.IsNullOrEmpty(endpoint) && !string.IsNullOrEmpty(agentId))
{
hostAgent = agentType.ToUpperInvariant() switch
{
"INVOICE" => await HostAgentFactory.CreateFoundryHostAgentAsync(agentType, modelId, endpoint, agentId, invoicePlugins),
"POLICY" => await HostAgentFactory.CreateFoundryHostAgentAsync(agentType, modelId, endpoint, agentId),
"LOGISTICS" => await HostAgentFactory.CreateFoundryHostAgentAsync(agentType, modelId, endpoint, agentId),
_ => throw new ArgumentException($"Unsupported agent type: {agentType}"),
};
}
else if (!string.IsNullOrEmpty(apiKey))
{
hostAgent = agentType.ToUpperInvariant() switch
{
"INVOICE" => await HostAgentFactory.CreateChatCompletionHostAgentAsync(
agentType, modelId, apiKey, "InvoiceAgent",
"""
You specialize in handling queries related to invoices.
""", invoicePlugins),
"POLICY" => await HostAgentFactory.CreateChatCompletionHostAgentAsync(
agentType, modelId, apiKey, "PolicyAgent",
"""
You specialize in handling queries related to policies and customer communications.
Always reply with exactly this text:
View on GitHub (pinned to c028a0c7dc)
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.
When it happens
Trigger: Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/Program.cs:52 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/bfb0bebe018cc2de.
Report an issue: GitHub.