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/HostAgentFactory.cs:27
using Microsoft.SemanticKernel.Agents.AzureAI;
namespace A2AServer;
internal static class HostAgentFactory
{
internal static async Task<A2AHostAgent> CreateFoundryHostAgentAsync(string agentType, string modelId, string endpoint, string assistantId, IEnumerable<KernelPlugin>? plugins = null)
{
var agentsClient = new PersistentAgentsClient(endpoint, new AzureCliCredential());
PersistentAgent definition = await agentsClient.Administration.GetAgentAsync(assistantId);
var agent = new AzureAIAgent(definition, agentsClient, plugins);
AgentCard agentCard = agentType.ToUpperInvariant() switch
{
"INVOICE" => GetInvoiceAgentCard(),
"POLICY" => GetPolicyAgentCard(),
"LOGISTICS" => GetLogisticsAgentCard(),
_ => throw new ArgumentException($"Unsupported agent type: {agentType}"),
};
return new A2AHostAgent(agent, agentCard);
}
internal static async Task<A2AHostAgent> CreateChatCompletionHostAgentAsync(string agentType, string modelId, string apiKey, string name, string instructions, IEnumerable<KernelPlugin>? plugins = null)
{
var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion(modelId, apiKey);
if (plugins is not null)
{
foreach (var plugin in plugins)
{
builder.Plugins.Add(plugin);
}
}
var kernel = builder.Build();
View on GitHub (pinned to c028a0c7dc)
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.
When it happens
Trigger: Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/HostAgentFactory.cs:27 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/4d1c013ef59adf02.
Report an issue: GitHub.