Principle:Microsoft Agent framework Framework Installation
| Knowledge Sources | |
|---|---|
| Domains | AI_Infrastructure, DevOps |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
A setup principle governing how the Microsoft Agent Framework is installed via pip and how environment credentials are configured for the chosen LLM provider. The framework is distributed as the agent-framework-core PyPI package with optional extras for Azure, declarative agents, and orchestrations. Authentication is driven entirely by environment variables, with distinct variable sets for OpenAI and Azure OpenAI backends.
Description
The Microsoft Agent Framework follows a modular installation approach. The core package (agent-framework-core) provides the base agent abstractions, chat client protocols, and tool infrastructure. Additional capabilities are delivered through optional extras and companion packages, allowing teams to install only what they need.
Package Structure
The framework is organized into several installable components:
- Core package (
agent-framework-core): The foundational package containing theAgentclass, chat client protocols (SupportsChatGetResponse), function tools, middleware, and OpenAI client support. Requires Python >= 3.10. - Azure extras (
agent-framework-core[azure]): Adds theAzureOpenAIResponsesClientand Azure identity dependencies for authenticating against Azure OpenAI endpoints. - All extras (
agent-framework-core[all]): Installs every optional extra in a single command, suitable for development and experimentation. - Declarative package (
agent-framework-declarative): Enables YAML/JSON-based agent definitions for no-code or low-code agent construction. - Orchestrations package (
agent-framework-orchestrations): Provides multi-agent orchestration patterns such as group chat, handoff, and sequential pipelines.
Key Dependencies
The core package carries a focused dependency set:
| Dependency | Minimum Version | Purpose |
|---|---|---|
pydantic |
>= 2 | Data validation and schema enforcement for agent configuration and tool parameters. |
openai |
>= 1.99.0 | OpenAI Python SDK powering the OpenAIResponsesClient.
|
azure-identity |
>= 1 | Azure credential management (included via the [azure] extra).
|
opentelemetry-api |
>= 1.39.0 | Distributed tracing and observability instrumentation. |
Environment Credential Configuration
The framework relies on environment variables for authentication rather than hardcoded credentials or configuration files. This approach integrates cleanly with CI/CD pipelines, container runtimes, and secret management systems. Two provider configurations are supported:
OpenAI
| Variable | Description |
|---|---|
OPENAI_API_KEY |
API key for authenticating with the OpenAI platform. Typically starts with sk-.
|
OPENAI_RESPONSES_MODEL_ID |
Model identifier to use for the Responses API (e.g., gpt-4o).
|
Azure OpenAI
| Variable | Description |
|---|---|
AZURE_OPENAI_API_KEY |
API key for authenticating with an Azure OpenAI resource. Can alternatively use Azure Identity (managed identity, service principal) when the [azure] extra is installed.
|
AZURE_OPENAI_ENDPOINT |
The full endpoint URL for the Azure OpenAI resource (e.g., https://your-resource.openai.azure.com/).
|
AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME |
The deployment name within the Azure OpenAI resource (e.g., gpt-4o).
|
Theoretical Basis
The installation principle follows environment-driven configuration:
runtime_config = package_install + environment_variables
This separation of code artifacts (pip packages) from runtime secrets (environment variables) reflects the Twelve-Factor App methodology:
- Explicit dependencies: All framework dependencies are declared in
pyproject.tomland resolved by pip at install time. There are no implicit system-level requirements beyond a compatible Python interpreter. - Config in the environment: Credentials and endpoint configuration live in environment variables, keeping secrets out of source control and enabling per-environment overrides without code changes.
- Minimal footprint: The extras system ensures that teams deploying against OpenAI do not need Azure SDKs installed, and vice versa, reducing attack surface and dependency conflicts.
Usage
Core Installation
# Install the core package
pip install agent-framework-core
# Install with all optional extras
pip install agent-framework-core[all]
# Install with Azure extras only
pip install agent-framework-core[azure]
Companion Packages
# Declarative agent definitions (YAML/JSON)
pip install agent-framework-declarative
# Multi-agent orchestration patterns
pip install agent-framework-orchestrations
OpenAI Environment Setup
export OPENAI_API_KEY="sk-..."
export OPENAI_RESPONSES_MODEL_ID="gpt-4o"
Azure OpenAI Environment Setup
export AZURE_OPENAI_API_KEY="..."
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME="gpt-4o"
Verification
from agent_framework import Agent
from agent_framework.openai import OpenAIResponsesClient
# Instantiate a client (reads OPENAI_API_KEY from environment)
client = OpenAIResponsesClient()
# Create an agent to verify the installation
agent = Agent(
client=client,
instructions="You are a helpful assistant.",
name="test-agent",
)