{"id":5561,"library":"agent-framework-azure-ai","title":"Azure AI Foundry Integration for Microsoft Agent Framework","description":"The `agent-framework-azure-ai` library provides an integration layer for various Azure AI services (e.g., Azure OpenAI, Azure AI Search, Azure Speech, Azure Vision) with the Microsoft Agent Framework. It enables developers to easily incorporate these powerful Azure capabilities into their agent-based applications. Currently at version `1.0.0rc6`, its release cadence is tied to the evolving Microsoft Agent Framework and Azure AI services, with new release candidates emerging as features stabilize.","status":"active","version":"1.0.0rc6","language":"en","source_language":"en","source_url":"https://github.com/microsoft/agent-framework-azure-ai","tags":["AI","Azure","Agent Framework","Microsoft","LLM","Search","Vision","Speech"],"install":[{"cmd":"pip install agent-framework-azure-ai","lang":"bash","label":"Install core library"}],"dependencies":[{"reason":"Core dependency; this library extends the Microsoft Agent Framework.","package":"agent-framework","optional":false},{"reason":"Required for Azure OpenAI service integration, especially for API calls.","package":"openai","optional":false},{"reason":"Dependency for data validation, explicitly pinned to `<2`.","package":"pydantic","optional":false},{"reason":"Required only if using Azure AI Search service integration.","package":"azure-search-documents","optional":true},{"reason":"Required only if using Azure Speech service integration.","package":"azure-cognitiveservices-speech","optional":true},{"reason":"Required only if using Azure Vision service integration.","package":"azure-ai-vision","optional":true}],"imports":[{"symbol":"AzureOpenAIService","correct":"from agent_framework_azure_ai.azure_open_ai_service import AzureOpenAIService"},{"symbol":"AzureAISearchService","correct":"from agent_framework_azure_ai.ai_search_service import AzureAISearchService"},{"symbol":"AzureSpeechService","correct":"from agent_framework_azure_ai.azure_speech_service import AzureSpeechService"},{"symbol":"AzureVisionService","correct":"from agent_framework_azure_ai.azure_vision_service import AzureVisionService"},{"note":"Imported from the parent `agent-framework` library.","symbol":"Agent","correct":"from agent_framework.core.agent import Agent"}],"quickstart":{"code":"import os\nfrom agent_framework.core.agent import Agent\nfrom agent_framework.core.model import ModelConfig\nfrom agent_framework_azure_ai.azure_open_ai_service import AzureOpenAIService\n\n# Ensure environment variables are set for Azure OpenAI\nazure_openai_endpoint = os.environ.get(\"AZURE_OPENAI_ENDPOINT\", \"https://YOUR_AZURE_OPENAI_ENDPOINT.openai.azure.com/\")\nazure_openai_api_key = os.environ.get(\"AZURE_OPENAI_API_KEY\", \"YOUR_AZURE_OPENAI_API_KEY\")\nazure_openai_deployment_name = os.environ.get(\"AZURE_OPENAI_DEPLOYMENT_NAME\", \"YOUR_DEPLOYMENT_NAME\")\n\nif \"YOUR_AZURE_OPENAI\" in azure_openai_endpoint or \"YOUR_AZURE_OPENAI\" in azure_openai_api_key or \"YOUR_DEPLOYMENT_NAME\" in azure_openai_deployment_name:\n    print(\"Please set AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, and AZURE_OPENAI_DEPLOYMENT_NAME environment variables.\")\n    print(\"Example: export AZURE_OPENAI_ENDPOINT='https://your-resource.openai.azure.com/'\")\n    print(\"Example: export AZURE_OPENAI_API_KEY='...' \")\n    print(\"Example: export AZURE_OPENAI_DEPLOYMENT_NAME='gpt-4o' \")\n    exit(1)\n\n# 1. Initialize the Azure OpenAI Service as an LLM\nazure_llm_service = AzureOpenAIService(\n    azure_endpoint=azure_openai_endpoint,\n    api_key=azure_openai_api_key,\n    deployment_name=azure_openai_deployment_name,\n    model_config=ModelConfig(max_tokens=256) # Optional: Configure LLM behavior\n)\n\n# 2. Create an Agent and provide it the Azure LLM\nagent = Agent(name=\"AzureAIAgent\").with_llm(azure_llm_service)\n\n# 3. Use the agent to get a response\nprint(f\"Agent '{agent.name}' is ready to chat...\")\nresponse = agent.chat(\"What is the capital of France?\")\nprint(f\"Agent response: {response.output}\")\n\n# Example with a simple tool (if using other Azure AI services as tools)\n# from agent_framework.core.tool import Tool\n# class MyAzureAISearchTool(Tool):\n#     def call(self, query: str) -> str:\n#         # Placeholder for actual Azure AISearchService logic\n#         return f\"Searching Azure AI Search for: {query}\"\n# agent.with_tool(MyAzureAISearchTool())\n# response_with_tool = agent.chat(\"Find documents about renewable energy.\")","lang":"python","description":"This quickstart demonstrates how to initialize the `AzureOpenAIService` provided by the library and integrate it as an LLM with the Microsoft Agent Framework. It requires proper Azure OpenAI service credentials set as environment variables."},"warnings":[{"fix":"Regularly check the official GitHub repository and PyPI for updates. Pin dependency versions for production, but anticipate necessary code modifications during upgrades.","message":"This library is currently in Release Candidate (RC) status (`1.0.0rc6`). APIs, module paths, and behaviors are subject to significant change without backward compatibility guarantees until a stable `1.0.0` release. Users should expect frequent updates and potential breaking changes.","severity":"breaking","affected_versions":"Pre-1.0.0 releases (e.g., all `rc` versions)"},{"fix":"Familiarize yourself with the `agent-framework` documentation before using this integration library.","message":"This library is an extension for the `agent-framework`. It *requires* `agent-framework` to be installed and understood. Core concepts like `Agent`, `LLM`, `Tool` come from the parent framework, not this library.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_DEPLOYMENT_NAME` (and similar for other services) are correctly set. Double-check your Azure resource configurations.","message":"Proper configuration of Azure AI service credentials (endpoint, API key, deployment name, etc.) via environment variables or explicit parameters is critical. Misconfigurations often lead to authentication errors or incorrect service routing.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your project's `pydantic` version is less than 2. If other dependencies require `pydantic>=2`, you may face irreconcilable conflicts until this library updates its `pydantic` compatibility.","message":"The library explicitly pins `pydantic<2` in its `install_requires`. Using `pydantic>=2` in your project alongside this library will cause dependency conflicts and likely runtime errors.","severity":"breaking","affected_versions":"All versions up to `1.0.0rc6`"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}