Files
Chris 904a5b843e Python / .NET Samples - Restructure and Improve Samples (Feature Branc… (#4092)
* Python: .NET Samples - Restructure and Improve Samples (Feature Branch) (#4091)

* Moved by agent (#4094)

* Fix readme links

* .NET Samples - Create `04-hosting` learning path step (#4098)

* Agent move

* Agent reorderd

* Remove A2A section from README 

Removed A2A section from the Getting Started README.

* Agent fixed links

* Fix broken sample links in durable-agents README (#4101)

* Initial plan

* Fix broken internal links in documentation

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Revert template link changes; keep only durable-agents README fix

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* .NET Samples - Create `03-workflows` learning path step (#4102)

* Fix solution project path

* Python: Fix broken markdown links to repo resources (outside /docs) (#4105)

* Initial plan

* Fix broken markdown links to repo resources

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Update README to rename .NET Workflows Samples section

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* .NET Samples - Create `02-agents` learning path step (#4107)

* .NET: Fix broken relative link in GroupChatToolApproval README (#4108)

* Initial plan

* Fix broken link in GroupChatToolApproval README

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Update labeler configuration for workflow samples

* .NET - Reorder Agents samples to start from Step01 instead of Step04 (#4110)

* Fix solution

* Resolve new sample paths

* Move new AgentSkills and AgentWithMemory_Step04 samples

* Fix link

* Fix readme path

* fix: update stale dotnet/samples/Durable path reference in AGENTS.md

Co-authored-by: crickman <66376200+crickman@users.noreply.github.com>

* Moved new sample

* Update solution

* Resolve merge (new sample)

* Sync to new sample - FoundryAgents_Step21_BingCustomSearch

* Updated README

* .NET Samples - Configuration Naming Update (#4149)

* .NET: Restore AzureFunctions index parity with ConsoleApps under DurableAgents samples (#4221)

* Clean-up `05_host_your_agent`

* Config setting consistency

* Refine samples

* AGENTS.md

* Move new samples

* Re-order samples

* Move new project and fixup solution

* Fixup model config

* Fix up new UT project

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
904a5b843e · 2026-02-26 00:56:10 +00:00
History
..

DevUI Step 01 - Basic Usage

This sample demonstrates how to add the DevUI to an ASP.NET Core application with AI agents.

What is DevUI?

The DevUI provides an interactive web interface for testing and debugging AI agents during development.

Configuration

Set the following environment variables:

  • AZURE_OPENAI_ENDPOINT - Your Azure OpenAI endpoint URL (required)
  • AZURE_OPENAI_DEPLOYMENT_NAME - Your deployment name (defaults to "gpt-4o-mini")

Running the Sample

  1. Set your Azure OpenAI credentials as environment variables
  2. Run the application:
    dotnet run
    
  3. Open your browser to https://localhost:50516/devui
  4. Select an agent or workflow from the dropdown and start chatting!

Sample Agents and Workflows

This sample includes:

Agents:

  • assistant - A helpful assistant
  • poet - A creative poet
  • coder - An expert programmer

Workflows:

  • review-workflow - A sequential workflow that generates a response and then reviews it

Adding DevUI to Your Own Project

To add DevUI to your ASP.NET Core application:

  1. Add the DevUI package and hosting packages:

    dotnet add package Microsoft.Agents.AI.DevUI
    dotnet add package Microsoft.Agents.AI.Hosting
    dotnet add package Microsoft.Agents.AI.Hosting.OpenAI
    
  2. Register your agents and workflows:

    var builder = WebApplication.CreateBuilder(args);
    
    // Set up your chat client
    builder.Services.AddChatClient(chatClient);
    
    // Register agents
    builder.AddAIAgent("assistant", "You are a helpful assistant.");
    
    // Register workflows
    var agent1Builder = builder.AddAIAgent("workflow-agent1", "You are agent 1.");
    var agent2Builder = builder.AddAIAgent("workflow-agent2", "You are agent 2.");
    builder.AddSequentialWorkflow("my-workflow", [agent1Builder, agent2Builder])
        .AddAsAIAgent();
    
  3. Add OpenAI services and map the endpoints for OpenAI and DevUI:

    // 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
        app.MapDevUI();
    }
    
    app.Run();
    
  4. Navigate to /devui in your browser