diff --git a/dotnet/samples/05-end-to-end/A2AClientServer/A2AServer/Program.cs b/dotnet/samples/05-end-to-end/A2AClientServer/A2AServer/Program.cs index c12a1c9431..c694351599 100644 --- a/dotnet/samples/05-end-to-end/A2AClientServer/A2AServer/Program.cs +++ b/dotnet/samples/05-end-to-end/A2AClientServer/A2AServer/Program.cs @@ -101,6 +101,10 @@ else throw new ArgumentException("Either A2AServer:ApiKey or A2AServer:ConnectionString & agentName must be provided"); } +// When running in production, make sure to use an SessionIsolationKeyProvider, e.g. ClaimsIdentity-based +// if using Claims-based Identity for Authentication/Authorization +// builder.Services.UseClaimsBasedSessionIsolation(new() { ClaimType = ClaimTypes.NameIdentifier }); + builder.AddA2AServer(hostA2AAgent); var app = builder.Build(); diff --git a/dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs b/dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs index a12ca1c5ad..e3b97d34e1 100644 --- a/dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs +++ b/dotnet/samples/05-end-to-end/AGUIClientServer/AGUIServer/Program.cs @@ -49,6 +49,10 @@ var agent = new AzureOpenAIClient( AGUIServerSerializerContext.Default.Options) ]); +// When running in production, make sure to use an SessionIsolationKeyProvider, e.g. ClaimsIdentity-based +// if using Claims-based Identity for Authentication/Authorization +// builder.Services.UseClaimsBasedSessionIsolation(new() { ClaimType = ClaimTypes.NameIdentifier }); + // Register the agent with the host and configure it to use an in-memory session store // so that conversation state is maintained across requests. In production, you may want to use a persistent session store. builder diff --git a/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.AgentHost/Program.cs b/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.AgentHost/Program.cs index 61cfdcdb68..ca399272b4 100644 --- a/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.AgentHost/Program.cs +++ b/dotnet/samples/05-end-to-end/AgentWebChat/AgentWebChat.AgentHost/Program.cs @@ -28,6 +28,10 @@ builder.AddDevUI(); builder.AddOpenAIChatCompletions(); builder.AddOpenAIResponses(); +// When running in production, make sure to use an SessionIsolationKeyProvider, e.g. ClaimsIdentity-based +// if using Claims-based Identity for Authentication/Authorization +// builder.Services.UseClaimsBasedSessionIsolation(new() { ClaimType = ClaimTypes.NameIdentifier }); + var pirateAgentBuilder = builder.AddAIAgent( "pirate", instructions: "You are a pirate. Speak like a pirate", @@ -148,6 +152,10 @@ builder.Services.AddKeyedSingleton("my-di-matchingname-agent", (sp, nam pirateAgentBuilder.AddA2AServer(); knightsKnavesAgentBuilder.AddA2AServer(); +// When running in production, make sure to use an SessionIsolationKeyProvider, e.g. ClaimsIdentity-based +// if using Claims-based Identity for Authentication/Authorization +// builder.Services.UseClaimsBasedSessionIsolation(new() { ClaimType = ClaimTypes.NameIdentifier }); + var app = builder.Build(); app.MapOpenApi();