Skip to content

JustinHaut/azure-agent-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Agent Framework

A Python project for exploring Azure OpenAI with Microsoft's Agent Framework.

Overview

This project provides a starting point for building AI agents with Microsoft Agent Framework, Microsoft's SDK for building AI agents in Python. It is configured to work with Azure OpenAI services.

Prerequisites

  • Python 3.10 or higher
  • An Azure account with access to Azure AI Foundry
  • An Azure OpenAI resource with a deployed model

Setup

1. Create the Virtual Environment

Run the setup script to create a Python virtual environment and install dependencies:

chmod +x setup.sh
./setup.sh

This script will:

  • Create a .venv directory if it doesn't exist
  • Activate the virtual environment
  • Install all packages from requirements.txt

2. Configure Environment Variables

Copy the example environment file and fill in your Azure OpenAI credentials:

cp .env.example .env

Edit the .env file with your values:

OPENAI_BASE_URL=https://your-resource-name.openai.azure.com/
OPENAI_API_KEY=your-api-key
OPENAI_CHAT_MODEL_ID=your-deployment-name

Getting Azure OpenAI Credentials from Azure AI Foundry

To obtain the required environment variables, follow these steps:

1. Access Azure AI Foundry

  1. Go to Azure AI Foundry
  2. Sign in with your Azure account

2. Create or Select a Project

  1. Create a new project or select an existing one
  2. Navigate to your project dashboard

3. Deploy a Model

  1. Go to Deployments in the left sidebar
  2. Click + Deploy model and select Deploy base model
  3. Choose a model (e.g., gpt-4o, gpt-4o-mini, or gpt-35-turbo)
  4. Configure the deployment settings and click Deploy
  5. Note the Deployment name - this is your OPENAI_CHAT_MODEL_ID

4. Get Your Endpoint and API Key

  1. In your project, go to Overview or Settings
  2. Find the Azure OpenAI connection details
  3. Copy the Endpoint URL - this is your OPENAI_BASE_URL
  4. Copy the API Key - this is your OPENAI_API_KEY

Alternatively, you can find these values in the Azure Portal:

  1. Go to Azure Portal
  2. Navigate to your Azure OpenAI resource
  3. Go to Keys and Endpoint in the left sidebar
  4. Copy the endpoint and one of the keys

Running the Example

After setting up the environment and configuring your credentials, run the example:

source .venv/bin/activate
python example.py

The example demonstrates:

  • Creating a chat client configured for Azure OpenAI
  • Building a ChatAgent with custom instructions
  • Getting a simple response from the agent
  • Using streaming responses

Activating the Virtual Environment

After running the setup script, activate the virtual environment in future sessions:

source .venv/bin/activate

To deactivate the virtual environment:

deactivate

Resources

About

Explore azure and semantic kernel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •