|
| 1 | +# Azure App Configuration - AI Agent chat application |
| 2 | + |
| 3 | +This sample demonstrates using Azure App Configuration to load agent YAML specifications that define AI agent behavior, prompts, and model configurations for a chat application. |
| 4 | + |
| 5 | +## Features |
| 6 | +- Integrates with Azure AI Agent Framework to create a conversational AI agent |
| 7 | +- Loads agent YAML specifications from Azure App Configuration. |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- .NET 10 SDK |
| 12 | +- An Azure subscription with: |
| 13 | + - An Azure App Configuration store |
| 14 | + - An Azure AI project with a deployed gpt-5 model. |
| 15 | +- User has **App Configuration Reader** role assigned for the Azure App Configuration resource. |
| 16 | +- User has **Azure AI User** role assigned for the Azure AI project. |
| 17 | + |
| 18 | +## Setup |
| 19 | + |
| 20 | +1. Clone the repository and navigate to the `examples\DotNetCore\ChatAgent` directory: |
| 21 | + ```bash |
| 22 | + git clone https://github.com/Azure/AppConfiguration.git |
| 23 | + cd examples\DotNetCore\ChatAgent |
| 24 | + ``` |
| 25 | + |
| 26 | +1. Install the required packages: |
| 27 | + |
| 28 | + ```bash |
| 29 | + dotnet restore |
| 30 | + ``` |
| 31 | + |
| 32 | +1. Add the following key-values to your Azure App Configuration store. |
| 33 | + |
| 34 | + | Key | Value | |
| 35 | + |-----|-------| |
| 36 | + | ChatAgent:Spec | _See YAML below_ | |
| 37 | + | ChatAgent:ProjectEndpoint | _Your Azure AI project endpoint_ | |
| 38 | + | ChatAgent:DeploymentName| gpt-5 | |
| 39 | + |
| 40 | + **YAML specification for _ChatAgent:Spec_** |
| 41 | + ```yaml |
| 42 | + kind: Prompt |
| 43 | + name: ChatAgent |
| 44 | + description: Agent example with web search |
| 45 | + instructions: You are a helpful assistant with access to web search. |
| 46 | + model: |
| 47 | + id: gpt-5 |
| 48 | + connection: |
| 49 | + kind: remote |
| 50 | + tools: |
| 51 | + - kind: webSearch |
| 52 | + name: WebSearchTool |
| 53 | + description: Search the web for live information. |
| 54 | + ``` |
| 55 | + |
| 56 | +1. Set the required environment variable: |
| 57 | + |
| 58 | + If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect: |
| 59 | + |
| 60 | + ```cmd |
| 61 | + setx AZURE_APPCONFIGURATION_ENDPOINT "<endpoint-of-your-app-configuration-store>" |
| 62 | + ``` |
| 63 | + |
| 64 | + If you use PowerShell, run the following command: |
| 65 | + ```powershell |
| 66 | + $Env:AZURE_APPCONFIGURATION_ENDPOINT="<endpoint-of-your-app-configuration-store>" |
| 67 | + ``` |
| 68 | + |
| 69 | + If you use macOS or Linux run the following command: |
| 70 | + ```bash |
| 71 | + export AZURE_APPCONFIGURATION_ENDPOINT='<endpoint-of-your-app-configuration-store>' |
| 72 | + ``` |
| 73 | + |
| 74 | +## Run the Application |
| 75 | + |
| 76 | +1. Start the console application: |
| 77 | + |
| 78 | + ```cmd |
| 79 | + dotnet run |
| 80 | + ``` |
| 81 | + |
| 82 | +1. Type the message "What is the weather in Seattle today?" when prompted with "How can I help?" and then press the Enter key |
| 83 | + |
| 84 | + ```Output |
| 85 | + How can I help? (type 'quit' to exit) |
| 86 | + User: What is the weather in Seattle today ? |
| 87 | + Agent response: Seattle weather for today (Thursday, April 9, 2026): |
| 88 | +
|
| 89 | + - Current conditions (as of ~10:48 AM PDT): 55°F, sunny. Wind N 6 mph (gusts 7), humidity 55%, pressure 30.05 in. ([wunderground.com](https://www.wunderground.com/weather/us/wa/seattle)) |
| 90 | + - Today’s forecast: Mostly sunny and mild. High around 64–65°F; tonight’s low near 43–44°F. Very low chance of precipitation and light winds. ([wunderground.com](https://www.wunderground.com/weather/us/wa/seattle)) |
| 91 | +
|
| 92 | + Want the hour‑by‑hour forecast or weekend outlook? |
| 93 | + Press enter to continue... |
| 94 | + ``` |
0 commit comments