Skip to content

About

A brief look at Azure Foundry SDK and Agent Service as well as Agent Framework

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Azure AI Foundry Agent SDK and Agent Framework Examples

This project provides tools for working with Azure AI Agents, including a management CLI and usage examples of the Microsoft Agent Framework.

Prerequisites

Authentication Setup

This project uses DefaultAzureCredential for authentication, which automatically uses your Azure CLI credentials.

  1. Install the Azure CLI
  2. Log in to Azure:
    az login
  3. Verify your login:
    az account show

RBAC Permissions Setup

To create and manage AI agents in Azure AI Foundry, you need one of the following Azure RBAC roles assigned on your Azure AI Foundry project:

  • Azure AI User

For more information, see Azure Foundry RBAC

Create and Activate a Python Virtual Environment named venv for (agent-framework-a.py, agent-framework-b.py)

It's recommended to use a virtual environment to manage dependencies:

python -m venv venv
source venv/bin/activate  # On Windows use `venv\Scripts\activate`

Install dependencies for venv virtual environment

Install the required dependencies:

pip install azure-ai-projects azure-identity python-dotenv
pip install agent-framework --pre

Deactivate the venv virtual environment

After you're done working in the virtual environment, you can deactivate it:

deactivate

Create and Activate a Python Virtual Environment named venv2 (foundry.py)

It's recommended to use a virtual environment to manage dependencies:

python -m venv venv2
source venv2/bin/activate  # On Windows use `venv2\Scripts\activate`

Install dependencies for venv2 virtual environment

Install the required dependencies:

pip install python-dotenv
pip install agent-framework-azure-ai --pre
pip install azure-ai-projects azure-identity

Deactivate the venv2 virtual environment

After you're done working in the virtual environment, you can deactivate it:

deactivate

Verify Installation

Check that the packages are installed correctly:

pip list
python -c "import agent_framework.azure; print(dir(agent_framework.azure))"

Usage

Agent Management CLI (foundry.py)

This script provides several commands to manage and interact with your Azure AI Agents.

Create an Agent

Creates a new agent using the configuration in your .env file.

python foundry.py create_agent

Delete an Agent

Deletes an agent by its ID.

python foundry.py delete_agent <agent_id>

List all Agents

Displays a list of all agents in the project.

python foundry.py list_agents

List Deployments

Shows all model deployments in the project.

python foundry.py list_deployments

Chat with Model (Basic)

Sends a simple test message ("How many feet are in a mile?") to the model deployment directly.

python foundry.py chat_with_agent

Chat with Specific Agent

Interacts with a specific agent by ID. This creates a thread, sends a user message, runs the agent, and retrieves the response.

python foundry.py chat_with_specific_agent <agent_id>

Reading Materials

About

A brief look at Azure Foundry SDK and Agent Service as well as Agent Framework

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages