Agent Framework DevUI in C# with Claude A developer built a sample showing how to mount Microsoft Agent Framework's DevUI into an ASP.NET Core web app, giving a chat page that lists and runs every registered agent and workflow while displaying tool calls and token counts live. The sample, built on Agent Framework 1.24.0 with .NET 10 and Aspire 13.6.5, registers a Claude Haiku-backed chat client through dependency injection and gates DevUI and its endpoints to the Development environment only. The author notes the prerelease DevUI and hosting packages (1.24.0-preview and 1.24.0-alpha) and warns that the page is a useful local bench but a leak anywhere else. The idea: DevUI is a page in your own web app that can run every agent and workflow the app registers. That makes it a good bench on your machine and a leak anywhere else. Every app in this series so far is a console app: change the question, run it again, read the output. DevUI replaces that loop with a chat page. It lists the agents and workflows the app registers, runs them, and shows each tool call and token count as it happens. It is not a separate tool. It is a set of endpoints mapped into an ASP.NET Core app, so it sees the agents exactly as the app configures them. Below, the kitchen assistant with its pantry tools and the planner and reviewer workflow from the first workflow post https://kootstra.io/writing/agent-framework-workflow-planner-reviewer/ move into one web app, Aspire starts it with the API key, and DevUI and the endpoints it calls exist only in Development. Versions: Microsoft Agent Framework 1.24.0, .NET 10, Aspire 13.6.5. DevUI and the hosting packages are prereleases: Microsoft.Agents.AI.DevUI and Microsoft.Agents.AI.Hosting are 1.24.0-preview.261006.1 , and Microsoft.Agents.AI.Hosting.OpenAI is 1.24.0-alpha.261006.1 . Code: samples/agent-framework/13-devui https://github.com/nkootstra/samples/tree/main/agent-framework/13-devui , a runnable version of this post with its tests. Who this is for: C developers who have an agent with tools and a workflow, and run them from an Aspire AppHost as in Agent Framework OpenTelemetry tracing in C with Claude https://kootstra.io/writing/agent-framework-opentelemetry-tracing-csharp/ . Note The code runs on Claude Haiku 5.5, but it depends only on IChatClient : the first post https://kootstra.io/writing/microsoft-agent-framework-first-csharp-agent/ swap-the-provider-by-changing-one-statement shows the swap to OpenAI or Ollama. The output limit of 4,096 tokens is sized for Haiku, which counts its reasoning as output. DevUI is mapped into an ASP.NET Core app, so the project starts from the web template. Microsoft.Agents.AI.DevUI depends on Microsoft.Agents.AI.Hosting and Microsoft.Agents.AI.Hosting.OpenAI , so one prerelease package brings in all three: dotnet new web -n KitchenBench cd KitchenBench dotnet add package Microsoft.Agents.AI --version 1.24.0 dotnet add package Microsoft.Agents.AI.Anthropic --version 1.24.0 dotnet add package Microsoft.Agents.AI.Workflows --version 1.24.0 dotnet add package Microsoft.Agents.AI.DevUI --version 1.24.0-preview.261006.1 In a console app each agent got the chat client passed in. In a web app the chat client goes into dependency injection, and every agent registered later resolves it from there: Program.cs using Anthropic; using Anthropic.Core; using Microsoft.Agents.AI; using Microsoft.Agents.AI.DevUI; using Microsoft.Agents.AI.Hosting; using Microsoft.Agents.AI.Workflows; using Microsoft.Extensions.AI; var builder = WebApplication.CreateBuilder args ; var apiKey = builder.Configuration "ANTHROPIC API KEY" ?? throw new InvalidOperationException "Set ANTHROPIC API KEY." ; builder.Services.AddChatClient new AnthropicClient new ClientOptions { ApiKey = apiKey } .AsIChatClient "claude-haiku-5-5", 4096 ; The key comes from configuration instead of Environment.GetEnvironmentVariable . ASP.NET Core reads environment variables into configuration, so ANTHROPIC API KEY still works, and a test can set the value without touching the process environment. The limit stays at 4,096 output tokens, for the same reason as in the first workflow post https://kootstra.io/writing/agent-framework-workflow-planner-reviewer/ : Haiku's reasoning counts as output. Leave out AddChatClient and the app stops at startup in Development, before the first request: Unhandled exception. System.InvalidOperationException: No service for type 'Microsoft.Extensions.AI.IChatClient' has been registered. builder.AddAIAgent registers a ChatClientAgent under a name. That name is the key in dependency injection and the ID DevUI shows. WithAITools registers tools for that name only: js var pantry = new PantryTools ; builder.AddAIAgent "kitchen-assistant", """ You help one household decide what to cook. Check the pantry with your tools before suggesting a dish. Prefer ingredients that expire soon. Answer in at most three sentences. """ .WithAITools AIFunctionFactory.Create pantry.FindInPantry, name: "find in pantry" , AIFunctionFactory.Create pantry.ListExpiringSoon, name: "list expiring soon" ; PantryTools is the class from the tools post https://kootstra.io/writing/tool-calling-ai-agents-csharp/ , unchanged. WithAITools adds each tool to the service collection under the agent's name, and the agent collects the tools registered under its name when it is created. The agent registration is a singleton by default, and every AddAIAgent overload takes a ServiceLifetime as its last argument. The agent itself is created the first time something asks for it. Here that is DevUI, which builds its list of agents when it is mapped, so a missing chat client fails at startup and not on the first message. The planner and the reviewer from the first workflow post https://kootstra.io/writing/agent-framework-workflow-planner-reviewer/ are two more registrations. AddAIAgent returns a builder whose Name the workflow uses to find the agents again: js var planner = builder.AddAIAgent "planner", """ You plan dinners for one household. Plan three dinners for the request. One line per dinner: the day, the dish and its main ingredients. Nothing else. """ ; var reviewer = builder.AddAIAgent "reviewer", """ You check a dinner plan against the household's rules: nobody eats peanuts, fish at most once a week, and every weekday dinner takes under 40 minutes. Return the plan in the same format with every broken rule fixed, then one line per change saying which rule it fixed. """ ; AddWorkflow registers a factory under a name, also as a singleton by default. The factory gets the service provider and that name, and resolves the two agents by their keys: js builder.AddWorkflow "dinner-review", sp, key = AgentWorkflowBuilder.BuildSequential key, // The workflow's name must equal its registration name. sp.GetRequiredKeyedService