From 43daa6c1c579b277e6a759fbb73b3fa4c5357a6a Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Thu, 6 Nov 2025 12:13:22 -0800 Subject: [PATCH 1/4] Don't add OpenAIResponses as part of Dev UI You should be able to add and remove Dev UI without impacting your other production endpoints. --- dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs b/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs index 4a85de121a..2162ce3ac7 100644 --- a/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs @@ -16,7 +16,6 @@ public static IHostApplicationBuilder AddDevUI(this IHostApplicationBuilder buil { ArgumentNullException.ThrowIfNull(builder); builder.Services.AddOpenAIConversations(); - builder.Services.AddOpenAIResponses(); return builder; } @@ -34,7 +33,6 @@ public static IEndpointConventionBuilder MapDevUI( group.MapDevUI(pattern: "/devui"); group.MapEntities(); group.MapOpenAIConversations(); - group.MapOpenAIResponses(); return group; } From 378de57a5f06015dcae0abcdc90c905771a258d5 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 7 Nov 2025 12:52:45 -0800 Subject: [PATCH 2/4] Remove `AddDevUI()` and do not map OpenAI endpoints from `MapDevUI()` --- .../DevUI/DevUI_Step01_BasicUsage/Program.cs | 9 +++---- .../DevUI/DevUI_Step01_BasicUsage/README.md | 18 +++++++++----- dotnet/samples/GettingStarted/DevUI/README.md | 17 +++++++------ .../DevUIExtensions.cs | 24 +++++++++---------- .../src/Microsoft.Agents.AI.DevUI/README.md | 12 ++++++---- 5 files changed, 46 insertions(+), 34 deletions(-) diff --git a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/Program.cs b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/Program.cs index e2e6e6b727..94950e8336 100644 --- a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/Program.cs +++ b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/Program.cs @@ -61,13 +61,14 @@ private static void Main(string[] args) [assistantBuilder, reviewerBuilder]) .AddAsAIAgent(); - if (builder.Environment.IsDevelopment()) - { - builder.AddDevUI(); - } + builder.Services.AddOpenAIResponses(); + builder.Services.AddOpenAIConversations(); var app = builder.Build(); + app.MapOpenAIResponses(); + app.MapOpenAIConversations(); + if (builder.Environment.IsDevelopment()) { app.MapDevUI(); diff --git a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md index 2b6cc28644..21a3b8b0ab 100644 --- a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md +++ b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md @@ -65,15 +65,21 @@ To add DevUI to your ASP.NET Core application: 3. Add DevUI services and map the endpoint: ```csharp - builder.AddDevUI(); + // Register services for OpenAI responses and conversations (also required for DevUI) + builder.Services.AddOpenAIResponses(); + builder.Services.AddOpenAIConversations(); + var app = builder.Build(); - - app.MapDevUI(); - - // Add required endpoints - app.MapEntities(); + + // Map endpoints for OpenAI responses and conversations (also required for DevUI) app.MapOpenAIResponses(); app.MapOpenAIConversations(); + + if (builder.Environment.IsDevelopment()) + { + // Map DevUI endpoint to /devui + app.MapDevUI(); + } app.Run(); ``` diff --git a/dotnet/samples/GettingStarted/DevUI/README.md b/dotnet/samples/GettingStarted/DevUI/README.md index 155d3f2b9d..45b2f6f63b 100644 --- a/dotnet/samples/GettingStarted/DevUI/README.md +++ b/dotnet/samples/GettingStarted/DevUI/README.md @@ -38,19 +38,22 @@ builder.Services.AddChatClient(chatClient); // Register your agents builder.AddAIAgent("my-agent", "You are a helpful assistant."); -// Add DevUI services -builder.AddDevUI(); +// Register services for OpenAI responses and conversations (also required for DevUI) +builder.Services.AddOpenAIResponses(); +builder.Services.AddOpenAIConversations(); var app = builder.Build(); -// Map the DevUI endpoint -app.MapDevUI(); - -// Add required endpoints -app.MapEntities(); +// Map endpoints for OpenAI responses and conversations (also required for DevUI) app.MapOpenAIResponses(); app.MapOpenAIConversations(); +if (builder.Environment.IsDevelopment()) +{ + // Map DevUI endpoint to /devui + app.MapDevUI(); +} + app.Run(); ``` diff --git a/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs b/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs index 2162ce3ac7..1364f92e2f 100644 --- a/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs @@ -9,22 +9,23 @@ namespace Microsoft.Agents.AI.DevUI; /// public static class DevUIExtensions { - /// - /// Adds the necessary services for the DevUI to the application builder. - /// - public static IHostApplicationBuilder AddDevUI(this IHostApplicationBuilder builder) - { - ArgumentNullException.ThrowIfNull(builder); - builder.Services.AddOpenAIConversations(); - - return builder; - } - /// /// Maps an endpoint that serves the DevUI from the '/devui' path. /// + /// + /// DevUI requires the OpenAI Responses and Conversations services to be registered with + /// See and + /// , + /// and the corresponding endpoints to be mapped using + /// and + /// . + /// /// The to add the endpoint to. /// A that can be used to add authorization or other endpoint configuration. + /// + /// + /// + /// /// Thrown when is null. public static IEndpointConventionBuilder MapDevUI( this IEndpointRouteBuilder endpoints) @@ -32,7 +33,6 @@ public static IEndpointConventionBuilder MapDevUI( var group = endpoints.MapGroup(""); group.MapDevUI(pattern: "/devui"); group.MapEntities(); - group.MapOpenAIConversations(); return group; } diff --git a/dotnet/src/Microsoft.Agents.AI.DevUI/README.md b/dotnet/src/Microsoft.Agents.AI.DevUI/README.md index 1f106e29ef..b55869748d 100644 --- a/dotnet/src/Microsoft.Agents.AI.DevUI/README.md +++ b/dotnet/src/Microsoft.Agents.AI.DevUI/README.md @@ -24,14 +24,16 @@ var builder = WebApplication.CreateBuilder(args); // Register your agents builder.AddAIAgent("assistant", "You are a helpful assistant."); -if (builder.Environment.IsDevelopment()) -{ - // Add DevUI services - builder.AddDevUI(); -} +// Register services for OpenAI responses and conversations (also required for DevUI) +builder.Services.AddOpenAIResponses(); +builder.Services.AddOpenAIConversations(); var app = builder.Build(); +// Map endpoints for OpenAI responses and conversations (also required for DevUI) +app.MapOpenAIResponses(); +app.MapOpenAIConversations(); + if (builder.Environment.IsDevelopment()) { // Map DevUI endpoint to /devui From 68ca5b5248228b458c77acd4e81c02bfec79c96b Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 7 Nov 2025 13:10:00 -0800 Subject: [PATCH 3/4] Fix comment wording --- dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs b/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs index 1364f92e2f..bbbf332f8b 100644 --- a/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.DevUI/DevUIExtensions.cs @@ -14,7 +14,7 @@ public static class DevUIExtensions /// /// /// DevUI requires the OpenAI Responses and Conversations services to be registered with - /// See and + /// and /// , /// and the corresponding endpoints to be mapped using /// and From 57640017d4d61b2981fd2bb505a58eb35f4c45df Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 7 Nov 2025 13:40:16 -0800 Subject: [PATCH 4/4] Revise documentation --- .../GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md index 21a3b8b0ab..0bf24dfb26 100644 --- a/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md +++ b/dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/README.md @@ -63,7 +63,7 @@ To add DevUI to your ASP.NET Core application: .AddAsAIAgent(); ``` -3. Add DevUI services and map the endpoint: +3. Add OpenAI services and map the endpoints for OpenAI and DevUI: ```csharp // Register services for OpenAI responses and conversations (also required for DevUI) builder.Services.AddOpenAIResponses();