Microsoft Developer explains how to build an AI agent using Microsoft Foundry models and Python in Visual Studio Code, including deployment, environment setup, and agent tracing.

Building an AI Agent with Microsoft Foundry Models in Python

Learn how to create and deploy an AI agent using Microsoft Foundry models with Python, guided by Microsoft Developer.

Overview

This tutorial walks you through the process of:

  • Deploying a Foundry model on Azure
  • Setting up your development environment with Python and Visual Studio Code
  • Creating an AI agent using the deployed model
  • Interacting with the agent through chat
  • Viewing agent traces and monitoring activity using the Microsoft Foundry portal

Step-by-Step Guide

1. Deploy a Microsoft Foundry Model

Start by deploying an AI model in Microsoft Foundry. Access the Foundry portal here: Microsoft Foundry.

2. Set Up the Environment

  • Use Visual Studio Code for development
  • Install Python and necessary dependencies (see the provided sample code)
  • Configure access and authentication for your Foundry resources

3. Create the AI Agent

  • Follow the sample code for agent creation (Sample Code)
  • Implement the agent logic in Python, connecting to the deployed Foundry model

4. Chat with the Agent

  • Test your AI agent by interacting through a chat interface
  • Observe how the agent leverages the deployed Foundry model responses

5. View Agent Traces in Foundry Portal

  • Use the Microsoft Foundry portal to monitor agent activity and trace chats
  • Analyze agent performance and adjust your implementation as needed

Additional Resources

Chapter Markers

  • 00:00 - 00:02 Introduction
  • 00:03 - 01:06 Deploy a model
  • 01:07 - 05:38 Setup environment
  • 05:39 - 08:10 Create an agent
  • 08:11 - 11:35 Chat with the agent
  • 11:36 - 13:46 View agent traces in the Microsoft Foundry portal

This tutorial is ideal for developers interested in leveraging Microsoft Foundry for AI agent development using Python.