LoopAI-103

Exercise: Create a generative AI chat app that uses tools

Unit 7 of 8 · Module 4: Develop generative AI apps that use tools

Before you start

Short explainers for ideas this lesson builds on. Watch these first if they're new to you.

0 of 1 watched · about 2 min
Read this lesson

Your turn

Now it's your turn to try tool calling, with the Responses API and Microsoft Foundry. In this lab, you build a travel assistant for Wayfarer Trips. You deploy a model, see how a tool changes its answers in the playground, and then write an app that grounds its responses in the company's travel brochures with the file search tool, and in current information with the web search tool. For the real thing, you'll need an Azure subscription with administrative access, Visual Studio Code, Python 3.13, Git, and the Azure CLI, and about thirty minutes.

The itinerary

First, create a Foundry project in a recommended region, and deploy gpt-5.2 with the default settings. In the playground, give it the travel assistant instructions, and ask for tourist activities in New York next month. Without tools, the answer is generic. Add the web search tool, ask again, and now it's current. Next, copy the Azure OpenAI endpoint from the project's home page, not the project endpoint. Clone the lab repo, create a Python environment, install the requirements, and put the endpoint and deployment name in the dot env file. In the code, create the OpenAI client with Entra ID authentication, create a vector store called travel brochures, and upload the brochure PDFs. Then call responses dot create with the instructions, the previous response ID, and two tools: file search, with your vector store, and web search. Sign in with az login, and run the app. Ask what's happening in San Francisco next month, and the web search tool answers. Then ask which hotels Wayfarer Trips offers there, and the file search tool finds them in the brochures. When you're done, delete the resource group.

Before you start

Here, you can practice the whole lab in a simulation: the portal, the playground, the configuration, and the terminal. Then, in the coding exercise, you write the app's code yourself, step by step, with Lou. Some features are in preview, so things may look a little different. Have a good trip.

Facts from Microsoft's documentation: Use the Azure OpenAI Responses API; Web search with the Responses API; File search tool for Microsoft Foundry agents; How to use function calling with Microsoft Foundry Models (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. The coding lab is based on Microsoft's lab files for the Foundry exercises (MicrosoftLearning/mslearn-ai-studio, MIT License; notice). Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.