01 Exercise π οΈ: Explore AI Agent Development π€
π Table of Contents
- π Overview
- π οΈ Prerequisites
- π Create an Azure AI Foundry Project and Agent
- π§ Create Your Agent
- π§ͺ Test Your Agent
- π§Ή Clean Up
π Overview
In this exercise, you will use the Azure AI Agent service in the Azure AI Foundry portal to create a simple AI agent that assists employees with expense claims.
π οΈ Prerequisites
- An active Azure subscription
- Access to the Azure AI Foundry portal
- Optional but recommended: A resource group dedicated to AI exercises
π Create an Azure AI Foundry Project and Agent
- Sign in to Azure AI Foundry
- Open your browser and go to:
- Sign in with your Azure credentials.
- Close any tips or quick-start panes.
-
If needed, click the Azure AI Foundry logo (top-left) to return to the Home page.
-
Start Agent Creation
-
On the Home page, click Create an agent.
-
Configure Project
- Project name: Enter a valid name (e.g.,
ExpensesAgentProject
). - Expand Advanced options and fill in:
- Azure AI Foundry resource: a valid resource name
- Subscription: your Azure subscription
- Resource group: select an existing group or create a new one
- Region: any AI Servicesβsupported region1
-
Click Create and wait for provisioning.
-
Deployment
- Once the project is created, the Agents playground opens automatically.
- A GPT-4o base model is deployed by default.
1 Some AI resources have regional model quotas. If you hit quota limits later, consider deploying in another region.
π§ Create Your Agent
You will build a simple agent that answers questions based on a corporate expenses policy.
- Download the Policy Document π
- In a new browser tab, download the Contoso expenses policy:
-
Save it locally as
Expenses_Policy.docx
. -
Open the Setup Pane π§©
- Return to the Agents playground tab.
-
Locate the Setup pane (side or below the chat window).
-
Agent Settings βοΈ
- Agent name:
ExpensesAgent
- Model deployment: ensure your GPT-4o deployment is selected
-
Instructions: click into the Instructions box and paste:
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.
-
Add Knowledge π
- Under Knowledge, click + Add β Files.
- In the dialog, create a new vector store named
Expenses_Vector_Store
and uploadExpenses_Policy.docx
. -
Verify that
Expenses_Vector_Store
appears in the Setup pane with 1 file. -
Add Actions π§ π»
- Under Actions, click + Add β Code interpreter, then click Save.
- (No additional files are needed for the code interpreter.)
π§ͺ Test Your Agent
Use the playground chat to verify your agentβs behavior.
- Basic Query π¬
- Prompt:
-
The agent should answer based on the policy document.
-
Submit a Claim β Part 1 π
- Prompt:
-
The agent should ask for your email address.
-
Submit a Claim β Part 2 π§
- Provide an email (e.g.,
fred@contoso.com
). -
The agent will then ask for a description and amount.
-
Submit a Claim β Part 3 π²
- Prompt:
-
The agent will use the code interpreter to generate a text file and provide a download link.
-
Verify β
- Download the generated
.txt
file and open it to confirm the expense claim details.