microsoft/semantic-kernel · error · ArgumentException

Either A2AServer:ApiKey or A2AServer:ConnectionString & agen

Error message

Either A2AServer:ApiKey or A2AServer:ConnectionString & agentId must be provided

What it means

Error "Either A2AServer:ApiKey or A2AServer:ConnectionString & agentId must be provided" thrown in microsoft/semantic-kernel.

Source

Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/Program.cs:96

            template."
            """, invoicePlugins),
        "LOGISTICS" => await HostAgentFactory.CreateChatCompletionHostAgentAsync(
            agentType, modelId, apiKey, "LogisticsAgent",
            """
            You specialize in handling queries related to logistics.
            
            Always reply with exactly:
            
            Shipment number: SHPMT-SAP-001
            Item: TSHIRT-RED-L
            Quantity: 900
            """, invoicePlugins),
        _ => throw new ArgumentException($"Unsupported agent type: {agentType}"),
    };
}
else
{
    throw new ArgumentException("Either A2AServer:ApiKey or A2AServer:ConnectionString & agentId must be provided");
}

app.MapA2A(hostAgent!.TaskManager!, "/");
app.MapWellKnownAgentCard(hostAgent!.TaskManager!, "/");

await app.RunAsync();

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Provide A2AServer:ApiKey in configuration, or provide both A2AServer:ConnectionString and the agentId value.
  2. Check appsettings.json / user secrets for the 'A2AServer' section and fill in the missing keys.

When it happens

Trigger: Thrown at dotnet/samples/Demos/A2AClientServer/A2AServer/Program.cs:96 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/c25bd7a0feb32f89. Report an issue: GitHub.