Welcome to the repository dedicated to the Agent to Agent and Agent to Tool: Building Next Gen Reasoning Systems on Azure workshop!
This repository contains code samples and instructions to help you go through the workshop exercises.
-
Open a browser window and navigate to the Azure AI Foundry portal.
-
Sign in with your Azure account credentials. The user name should be
fllm-labuser-NN@foundationallm.ai, whereNNis your assigned number during the workshop. The password will also be provided during the workshop.
Important
You will be asked to provide additional settings to keep the >account secure. Please make sure you skip the multi-factor >authentication (MFA) setup, as this is not supported in the >workshop environment.
-
Select
Nexton theLet's keep your account securepage.Select
Skip setup. -
After signing in, you will be presented with the list of Azure AI Foundry projects. Select the project named
project-NN, whereNNis your assigned number during the workshop.
Important
Your account has the required access only to the project-NN project. Please make sure you select the correct project, otherwise you will see multiple permissions errors and will not be able to complete the exercises.
Requirements:
- Visual Studio Code (download here). Make sure to install the
PythonandPython Debuggerextensions for Visual Studio Code (search for "Python" and "Python Debugger" in the Extensions view and install the ones published by Microsoft). - Python 3.11 or later (download here).
- Azure CLI 2.77.0 (download here).
Once you have installed the prerequisites, follow these steps to set up your local environment:
-
Clone this repository to your local machine and open it in Visual Studio Code. You can use the following command in your terminal (make sure to run it in the directory where you want to clone the repository):
git clone https://github.com/foundationallm/nextgenai-agents-workshop NextGenAI-Agents-Workshop
-
In Visual Studio Code, select
CTRL+SHIFT+P(orCMD+SHIFT+Pon Mac) to open the command palette, then typePython: Create Environmentand select it. When prompted, selectVenvas the environment type andPython 3.11(or above) as the base interpreter. When prompted to select dependencies to install, selectrequirements.txtand then selectOK. This will trigger the creation of a new Python virtual environment named.venvand install the required dependencies. The process may take a few minutes and the progress will be shown in a popup in the bottom right corner of Visual Studio Code (you can selectShow logsif want to see more details).If you prefer to create the virtual environment manually, you can do so by following these steps:
-
Open the Powershell terminal in Visual Studio Code (View > Terminal) and create a new Python virtual environment by running the following command (if it's a PowerShell terminal):
& 'C:\Program Files\Python311\python.exe' -m venv .venv
Make sure to adjust the path to
python.exeif your Python installation is in a different location. -
Once your virtual environment is created, activate it by running the following command:
.\.venv\Scripts\activate
-
Install the required dependencies by running the following command:
pip install -r requirements.txt
-
-
Configure the environment variables required to run the code samples. You can do this by creating a
.envfile in the root of the repository (next toREADME.md) and adding the following lines to it:PROJECT_ENDPOINT=<project_endpoint> MODEL_DEPLOYMENT_NAME=gpt-4o
Make sure to replace
<project_endpoint>with the actual project endpoint URL. You can find the project endpoint URL in the Azure AI Foundry portal by selectingOverviewin the left-hand menu and then copying the value underAzure AI Foundry project endpoint: -
Log in to your Azure account using the Azure CLI by running the following command in the terminal:
az login
This will open a popup where you must select the
Work or school accountoption and then sign in with your Azure account credentials. Make sure to use the same account you used to sign in to the Azure AI Foundry portal.
Important
You will be asked to provide additional settings to keep the >account secure. Please make sure you skip the multi-factor >authentication (MFA) setup, as this is not supported in the >workshop environment (see the Sign into the Azure AI Foundry portal section for more details).
- If you are prompted to select a subscription, make sure to select the subscription named
FoundationaLLM Demoswith the subscription IDd2602cd1-e330-4e81-8edf-712f8a2f4130.
Before running any Python file in this repo, make sure you complete the steps in the Set up your local environment (optional) section.
To run a Python file in the local environment, follow these steps:
-
In Visual Studio Code, open a terminal (View > Terminal) and make sure your Python virtual environment is activated. Also, make sure you are in the root directory of the repository (where
README.mdis located). -
Run the Python file by using the following command:
python <file_name>.py
Make sure to replace
<file_name>with the actual name of the Python file you want to run (e.g.,first_agent.py).
Before debugging any Python file in this repo, make sure you complete the steps in the Set up your local environment (optional) section.
If you want to run the Python files in debug mode so you can understand in more detail how they work, you can do so by following these steps:
-
In Visual Studio Code, open the Python file you want to debug.
-
Set a breakpoint by clicking in the gutter to the left of the line number where you want to pause execution. The recommended line to set a breakpoint is the line that contains the
project_client = AIProjectClient(method call. -
Select
CTRL+SHIFT+D(orCMD+SHIFT+Don Mac) to open the command selector and typePython Debugger: Python Debugger: Debug Python fileand select it. This will start the debugger and run the Python file in debug mode.
This exercise is performed in the Azure AI Foundry portal. Before starting the exercise, please make sure you have completed the Sign into the Azure AI Foundry portal instructions from the Prerequisites section. The instructions assume you are already signed into the Azure AI Foundry portal and have selected your project.
To complete this exercise, follow these steps:
-
In the left-hand menu, select
Agents. If prompted, select thegpt-4omodel deployment to use with the agents. -
Select
+ New agentto create a new agent.The new agent will be created with a default name and will be displayed in the list of agents. Select
Try in playgroundto open the agent in the playground. -
In the playground, add the following text to the
Instructionsproperty of the agent:You are a witty and funny agent that takes the perspective of a cat observing humans performing daily activities. You are both OCD and critical about what you see the humans doing, and you are more than happy to share your opinion on that.
and then submit the following prompt (referenced as user query in the playground):
We are all attending a conference for AI software development. What do you think about that?
-
Submit other prompts to see how the agent responds. Optionally, you can modify the
Instructionsproperty of the agent to see how it affects the responses.
This exercise is a code-only exercise. Before starting the exercise, please make sure you have completed the Prerequisites section (including the optional Setup your local environment).
Run first_agent.py using the instructions from the Running a Python file in the local environment (optional) section. Optionally, you can run the file in debug mode using the instructions from the Debugging a Python file in the local environment (optional) section.
This exercise is performed in the Azure AI Foundry portal. Before starting the exercise, please make sure you have completed the Sign into the Azure AI Foundry portal instructions from the Prerequisites section. The instructions assume you are already signed into the Azure AI Foundry portal and have selected your project.
To complete this exercise, follow these steps:
-
Create a new agent in the Azure AI Foundry portal and use the following text for the instructions (see the steps in the Exercise 1: Create a simple agent (witty cat) in AI Foundry section for reference):
You politely help with math questions.
-
In the
Actionssection select+ Addaction and then selectCode interpreterfrom the list of available tools. -
Save the code interpreter action without adding any files.
-
In the playground, submit the following prompt (referenced as user query in the playground):
Use python code to compute the first 10 digits of the Gray code cycle.
This exercise is a code-only exercise. Before starting the exercise, please make sure you have completed the Prerequisites section (including the optional Setup your local environment).
Run agent-code-interpreter.py using the instructions from the Running a Python file in the local environment (optional) section. Optionally, you can run the file in debug mode using the instructions from the Debugging a Python file in the local environment (optional) section.
This exercise is a code-only exercise. Before starting the exercise, please make sure you have completed the Prerequisites section (including the optional Setup your local environment).
Run agent-mcp.py using the instructions from the Running a Python file in the local environment (optional) section. Optionally, you can run the file in debug mode using the instructions from the Debugging a Python file in the local environment (optional) section.
This exercise is a code-only exercise. Before starting the exercise, please make sure you have completed the Prerequisites section (including the optional Setup your local environment).
Run agent-mcp-mslearn.py using the instructions from the Running a Python file in the local environment (optional) section. Optionally, you can run the file in debug mode using the instructions from the Debugging a Python file in the local environment (optional) section.
This exercise is performed in the Azure AI Foundry portal. Before starting the exercise, please make sure you have completed the Sign into the Azure AI Foundry portal instructions from the Prerequisites section. The instructions assume you are already signed into the Azure AI Foundry portal and have selected your project.
To complete this exercise, follow these steps:
-
Create a new agent in the Azure AI Foundry portal and use the following text for the instructions (see the steps in the Exercise 1: Create a simple agent (witty cat) in AI Foundry section for reference):
You are a helpful agent.
-
In the
Actionssection select+ Addaction and then selectOpenAPI 3.0 specified toolfrom the list of available tools. Enter the following values in theTool detailssection and then selectNextto advance:- Name:
get_weather. - Description:
Retrieve weather information.
- Name:
-
In the
Define schemasection, paste the contents of the weather_openapi.json and then selectNextto advance. -
In the
Reviewsection selectCreate toolto create the tool. -
In the playground, submit the following prompt (referenced as user query in the playground):
What's the weather in Orlando, Florida?
This exercise is a code-only exercise. Before starting the exercise, please make sure you have completed the Prerequisites section (including the optional Setup your local environment).
Run agent-openapi-holidays.py using the instructions from the Running a Python file in the local environment (optional) section. Optionally, you can run the file in debug mode using the instructions from the Debugging a Python file in the local environment (optional) section.
This exercise will be presented as an interactive demo by the workshop instructor.
This exercise will be presented as an interactive demo by the workshop instructor.
This exercise will be presented as an interactive demo by the workshop instructor.
This exercise is performed in the Azure AI Foundry portal. Before starting the exercise, please make sure you have completed the Sign into the Azure AI Foundry portal instructions from the Prerequisites section. The instructions assume you are already signed into the Azure AI Foundry portal and have selected your project.
To complete this exercise, follow these steps:
-
Create a new agent in the Azure AI Foundry portal and use the following text for the instructions (see the steps in the Exercise 1: Create a simple agent (witty cat) in AI Foundry section for reference):
You are a helpful agent.
-
In the
Knowledgesection select+ Addand then selectMicrosoft Fabricfrom the list of available tools. -
In the
Choose an existing Microsoft Fabric connectiondialog, select theFabric-TestAgent01connection and then selectConnect. -
In the playground, submit the following prompt (referenced as user query in the playground):
What is the latest closing price for MSFT?
Important
If you receive an answer like this:
It seems I'm unable to retrieve the closing price for Microsoft (MSFT) at this moment. To get the most up-to-date stock prices, I recommend checking a financial news website (like Bloomberg or Yahoo Finance) or a stock trading app.
you need to activate your account in Microsoft Fabric. To do that, open a new browser tab and navigate to https://fabric.microsoft.com and sign in with your Azure account credentials (the same you used to sign in to the Azure AI Foundry portal). If asked to configure additional security settings, please skip the multi-factor authentication (MFA) setup, as this is not supported in the workshop environment (see the Sign into the Azure AI Foundry portal section for more details). After signing in, you will be presented with the Microsoft Fabric welcome page. You can close the browser tab and return to the Azure AI Foundry portal. Now, if you submit the prompt again in the playground, you should get a valid answer.
This exercise is performed in the Azure AI Foundry portal. Before starting the exercise, please make sure you have completed the Sign into the Azure AI Foundry portal instructions from the Prerequisites section. The instructions assume you are already signed into the Azure AI Foundry portal and have selected your project.
To complete this exercise, follow these steps:
-
Create a new agent in the Azure AI Foundry portal and use the following text for the instructions (see the steps in the Exercise 1: Create a simple agent (witty cat) in AI Foundry section for reference):
You are a helpful agent that can delegate tasks to other agents as needed.
-
In the
Connected agentssection select+ Addand then provide the following values in theAdding a connected agentdialog:- Agent: Select the agent you created in the Exercise 1: Create a simple agent (witty cat) in AI Foundry section.
- Alias:
cat_agent. - Detail the steps to activate the agent:
An agent that takes the perspective of a cat observing humans performing daily activities.
-
In the playground, submit the following prompt (referenced as user query in the playground):
Thru the eyes of a cat, how do you see us at this AI tech conference?










