Overview
Microsoft Agent Framework is available for both Python and .NET. This guide covers installation, authentication setup, and environment configuration.System Requirements
- Python
- .NET
- Python version: 3.10 or higher (supports 3.10, 3.11, 3.12, 3.13, 3.14)
- Package manager: pip or uv
- Operating systems: Windows, macOS, Linux
Install the framework
- Python
- .NET
Authentication setup
Microsoft Agent Framework uses Azure CLI credentials for authentication in development.Install Azure CLI
Download and install from Azure CLI documentation:
- Windows
- macOS
- Linux
Login to Azure
Environment configuration
Required environment variables
Set these environment variables based on your provider:- Azure AI Foundry (Python)
- Azure OpenAI (.NET)
- OpenAI (Python)
Get your project endpoint from ai.azure.com → Your Project → Overview → Project connection string
Optional environment variables
Azure AI Search (RAG)
Azure AI Search (RAG)
Anthropic Claude
Anthropic Claude
Ollama (Local Models)
Ollama (Local Models)
Observability (OpenTelemetry)
Observability (OpenTelemetry)
Mem0 (Memory)
Mem0 (Memory)
Using .env files
For convenience, create a.env file in your project root:
- Python
- .NET
Create Load in your code:
.env:Verify your installation
Test your setup with a minimal example:- Python
- .NET
Troubleshooting
Authentication errors
Authentication errors
Error:
DefaultAzureCredential failed to retrieve a tokenSolution:- Ensure you’ve run
az loginand authenticated successfully - Check that your Azure account has access to the resources
- Verify your subscription is active:
az account show - Try clearing cached credentials:
az account clearthenaz loginagain
Module not found errors (Python)
Module not found errors (Python)
Error:
ModuleNotFoundError: No module named 'agent_framework'Solution:- Verify installation:
pip show agent-framework-core - Check you’re using the correct Python environment
- Reinstall:
pip install --force-reinstall agent-framework --pre
Package not found errors (.NET)
Package not found errors (.NET)
Error:
Package 'Microsoft.Agents.AI.OpenAI' could not be foundSolution:- Ensure you have access to the NuGet package source
- Clear NuGet cache:
dotnet nuget locals all --clear - Restore packages:
dotnet restore
Environment variables not loading
Environment variables not loading
Error: Variables in
.env not being readSolution:Python:- Ensure
python-dotenvis installed:pip install python-dotenv - Add
load_dotenv()before accessing environment variables - Check
.envfile is in the same directory as your script
- Install DotNetEnv:
dotnet add package DotNetEnv - Call
DotNetEnv.Env.Load()at the start of your program
Connection timeout errors
Connection timeout errors
Error: Request timeout when calling Azure servicesSolution:
- Check your network connection and firewall settings
- Verify the endpoint URL is correct
- Ensure the Azure resource is running and accessible
- Check Azure service health: Azure Status
Next steps
Quickstart Guide
Build your first agent in 5 minutes
Core Concepts
Understand agents, tools, and sessions
Provider Configuration
Configure different LLM providers
Sample Code
Explore example projects
For additional help, visit the GitHub repository or join our Discord community.