This repository contains the code and resources for building an AI-powered travel agent using Microsoft Agent Framework (MAF) and Azure AI services.
- Azure Subscription: Sign up for a free Azure account
- Azure Developer CLI (azd): Required for provisioning Azure resources
Run the following command in your terminal to verify the installation:
azd versionCreate your Azure environment by provisioning the necessary resources:
First, authenticate with your Azure account using the Azure Developer CLI:
azd auth login --use-device-codeFollow the prompts to complete the authentication process in your browser.
Create a new environment for your Azure resources:
azd env new dev
azd env select dev
azd env set AZURE_LOCATION australiaeastNote: You can change
australiaeastto any Azure region that supports AI Foundry. Common options include:eastus,westus2,westeurope,southeastasia.
Deploy all required Azure resources using a single command:
azd upThis command will:
- Provision Azure AI Foundry resources (AI Hub, AI Project)
- Deploy AI models
- Configure authentication and permissions
Note: The deployment process may take 5-10 minutes to complete.
- Navigate to the Azure Portal
- Look for a resource group named
rg-aiagent-ws-dev(or similar, based on your environment name) - Verify the following resources are created:
- Azure AI Hub
- Azure AI Project
- AI models (e.g., GPT-4)
- Azure Cosmos DB
- Azure AI Search
To work through the labs, you need to run both the backend (.NET) and frontend (React) applications simultaneously.
Navigate to the backend folder:
cd src/backendStart the backend server by running the following command. This will start the backend API server on http://localhost:5001:
dotnet runIn a separate terminal, navigate to the frontend folder:
cd src/frontendInstall the required npm packages (if you haven't already):
npm installBuild the frontend application:
npm run buildStart the frontend server:
npm startTo access the frontend application, open your browser to http://localhost:3000.
-
API Testing: Navigate to the file
src/backend/ContosoTravelAgent.httpin the code repository. This file contains HTTP requests that you can use to interact with the backend API. Click on theSend Requestlink above each request in the file. -
Web Application Testing: Open your web browser and navigate to
http://localhost:3000. Click on theNew Chatbutton to start a new conversation with the AI travel agent. Send a few messages to verify that the frontend and backend are communicating correctly.
Start the conversation with:
Hi! I want to plan my next vacation
Expected Response: Agent greets you and asks about your travel preferences (e.g., budget, travel style, interests).
Answer the agent's questions to build your profile.
Expected Response: Agent provides personalized destination recommendations and stores your profile information (travel style, budget, interests, past trips, places to visit).
Test that the agent remembers your preferences in a new session.
Start a new conversation by clicking on New Chat in the frontend UI, then ask:
Suggest a vacation for me
Expected Response: Agent references your stored profile and provides personalized recommendations based on your preferences.
Note that the user preferences are stored in memory and will be lost if the backend server is restarted. You can save the user profile to a persistent database (e.g., Azure Cosmos DB).