Skip to content

01 Exercise πŸ› οΈ: Explore AI Agent Development πŸ€–

πŸ“š Table of Contents

  1. πŸ“Œ Overview
  2. πŸ› οΈ Prerequisites
  3. πŸš€ Create an Azure AI Foundry Project and Agent
  4. 🧠 Create Your Agent
  5. πŸ§ͺ Test Your Agent
  6. 🧹 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

  1. Sign in to Azure AI Foundry
  2. Open your browser and go to:
    https://ai.azure.com
    
  3. Sign in with your Azure credentials.
  4. Close any tips or quick-start panes.
  5. If needed, click the Azure AI Foundry logo (top-left) to return to the Home page.

  6. Start Agent Creation

  7. On the Home page, click Create an agent.

  8. Configure Project

  9. Project name: Enter a valid name (e.g., ExpensesAgentProject).
  10. 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
  11. Click Create and wait for provisioning.

  12. Deployment

  13. Once the project is created, the Agents playground opens automatically.
  14. 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.

  1. Download the Policy Document πŸ“„
  2. In a new browser tab, download the Contoso expenses policy:
    https://raw.githubusercontent.com/MicrosoftLearning/mslearn-ai-agents/main/Labfiles/01-agent-fundamentals/Expenses_Policy.docx
    
  3. Save it locally as Expenses_Policy.docx.

  4. Open the Setup Pane 🧩

  5. Return to the Agents playground tab.
  6. Locate the Setup pane (side or below the chat window).

  7. Agent Settings βš™οΈ

  8. Agent name: ExpensesAgent
  9. Model deployment: ensure your GPT-4o deployment is selected
  10. 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.
    
  11. Add Knowledge πŸ“š

  12. Under Knowledge, click + Add β†’ Files.
  13. In the dialog, create a new vector store named Expenses_Vector_Store and upload Expenses_Policy.docx.
  14. Verify that Expenses_Vector_Store appears in the Setup pane with 1 file.

  15. Add Actions πŸ§ πŸ’»

  16. Under Actions, click + Add β†’ Code interpreter, then click Save.
  17. (No additional files are needed for the code interpreter.)

πŸ§ͺ Test Your Agent

Use the playground chat to verify your agent’s behavior.

  1. Basic Query πŸ’¬
  2. Prompt:
    What's the maximum I can claim for meals?
    
  3. The agent should answer based on the policy document.

  4. Submit a Claim – Part 1 πŸ“

  5. Prompt:
    I'd like to submit a claim for a meal.
    
  6. The agent should ask for your email address.

  7. Submit a Claim – Part 2 πŸ“§

  8. Provide an email (e.g., fred@contoso.com).
  9. The agent will then ask for a description and amount.

  10. Submit a Claim – Part 3 πŸ’²

  11. Prompt:
    Breakfast cost me $20.
    
  12. The agent will use the code interpreter to generate a text file and provide a download link.

  13. Verify βœ…

  14. Download the generated .txt file and open it to confirm the expense claim details.