This project provides tools for working with Azure AI Agents, including a management CLI and usage examples of the Microsoft Agent Framework.
This project uses DefaultAzureCredential for authentication, which automatically uses your Azure CLI credentials.
- Install the Azure CLI
- Log in to Azure:
az login
- Verify your login:
az account show
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 the required dependencies:
pip install azure-ai-projects azure-identity python-dotenv
pip install agent-framework --preAfter you're done working in the virtual environment, you can deactivate it:
deactivateIt'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 the required dependencies:
pip install python-dotenv
pip install agent-framework-azure-ai --pre
pip install azure-ai-projects azure-identityAfter you're done working in the virtual environment, you can deactivate it:
deactivateCheck that the packages are installed correctly:
pip listpython -c "import agent_framework.azure; print(dir(agent_framework.azure))"This script provides several commands to manage and interact with your Azure AI Agents.
Creates a new agent using the configuration in your .env file.
python foundry.py create_agentDeletes an agent by its ID.
python foundry.py delete_agent <agent_id>Displays a list of all agents in the project.
python foundry.py list_agentsShows all model deployments in the project.
python foundry.py list_deploymentsSends a simple test message ("How many feet are in a mile?") to the model deployment directly.
python foundry.py chat_with_agentInteracts 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>