Overview
This exercise demonstrates how to create an AI agent using Azure AI Foundry. The agent assists employees with expense claims by leveraging a GPT-4o model and grounding responses in a corporate expenses policy document.
Steps & Configuration Details
1. Create an Azure AI Foundry Project
- Open Azure AI Foundry portal (https://ai.azure.com) and sign in.
- Select Create an agent.
- Configuration Items:
- Azure AI Foundry Resource: A valid name.
- Subscription: Your Azure subscription.
- Resource Group: Select or create a resource group.
- Region: Choose any AI Services-supported location.
- Project Name: A unique name.
After creation, the Agents playground opens automatically, with a GPT-4o base model deployed.
2. Configure the AI Agent
- Set the Agent Name to
ExpensesAgent
. - Ensure the GPT-4o model deployment is selected.
- Define Instructions:
You are an AI assistant for corporate expenses. You answer questions about expenses based on the expenses policy data. If a user wants to submit an expense claim, you get their email address, a description of the claim, and the amount to be claimed and write the claim details to a text file that the user can download.
3. Add Knowledge to the Agent
- Download the expenses policy document:
https://raw.githubusercontent.com/MicrosoftLearning/mslearn-ai-agents/main/Labfiles/01-agent-fundamentals/Expenses_Policy.docx
- Upload the document to Azure AI Foundry:
- Select + Add Knowledge → Files.
- Create a Vector Store named
Expenses_Vector_Store
. - Upload and save
Expenses_Policy.docx
.
Configuration Items:
- Vector Store Name:
Expenses_Vector_Store
- File Count:
1
4. Add Actions to the Agent
- Select + Add Action → Code Interpreter.
- Save the configuration.
The Code Interpreter allows the agent to generate and execute Python code for processing expense claims.
5. Test the AI Agent
- Open the Playground Chat.
- Submit the prompt:
What's the maximum I can claim for meals?
- The response should be based on the uploaded expenses policy document.
- Submit a follow-up prompt:
I'd like to submit a claim for a meal.
- The agent should request an email address.
- Provide an email (e.g.,
[email protected]
). - Submit a claim description and amount:
Breakfast cost me $20.
- The agent should generate a text file with claim details and provide a download link.
6. Clean Up
- Delete Azure resources to avoid unnecessary costs:
- Open Azure Portal (https://portal.azure.com).
- Navigate to Resource Groups.
- Select the resource group and click Delete.