{"id":14409,"library":"agent-framework-azure-ai-search","title":"Azure AI Search Integration for Microsoft Agent Framework","description":"The `agent-framework-azure-ai-search` library provides an integration for Azure AI Search with Microsoft's Agent Framework. It offers an `AzureAISearch` tool wrapper, enabling agents to perform search queries against Azure AI Search indexes. Currently in beta version `1.0.0b260409`, its development is active with frequent updates as part of the broader Agent Framework initiative.","status":"active","version":"1.0.0b260409","language":"en","source_language":"en","source_url":"https://github.com/microsoft/agent-framework/tree/main/python/packages/agent-framework-azure-ai-search","tags":["agent-framework","azure","ai-search","llm-tools","microsoft","beta"],"install":[{"cmd":"pip install agent-framework-azure-ai-search","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"Required for core agent framework functionality, including `Agent` and `Agency` classes.","package":"agent-framework-core","optional":false},{"reason":"Underlying Azure SDK for interacting with Azure AI Search.","package":"azure-search-documents","optional":false}],"imports":[{"note":"The `AzureAISearch` class is located within the `tool` submodule, not directly at the top-level package.","wrong":"from agent_framework_azure_ai_search import AzureAISearch","symbol":"AzureAISearch","correct":"from agent_framework_azure_ai_search.tool import AzureAISearch"}],"quickstart":{"code":"import asyncio\nimport os\nfrom agent_framework_azure_ai_search.tool import AzureAISearch\n\nasync def main():\n    # Set these environment variables or replace with actual values\n    # AZURE_AI_SEARCH_ENDPOINT = os.environ.get('AZURE_AI_SEARCH_ENDPOINT', 'YOUR_AI_SEARCH_ENDPOINT')\n    # AZURE_AI_SEARCH_API_KEY = os.environ.get('AZURE_AI_SEARCH_API_KEY', 'YOUR_AI_SEARCH_API_KEY')\n    # AZURE_AI_SEARCH_INDEX_NAME = os.environ.get('AZURE_AI_SEARCH_INDEX_NAME', 'YOUR_AI_SEARCH_INDEX_NAME')\n\n    # The AzureAISearch tool automatically picks up environment variables.\n    # Ensure AZURE_AI_SEARCH_ENDPOINT and AZURE_AI_SEARCH_API_KEY are set.\n    # AZURE_AI_SEARCH_INDEX_NAME is optional for default index.\n    \n    # For demonstration, we'll try to get values from env, provide placeholders if not found\n    endpoint = os.environ.get('AZURE_AI_SEARCH_ENDPOINT', 'https://example.search.windows.net')\n    api_key = os.environ.get('AZURE_AI_SEARCH_API_KEY', 'YOUR_AI_SEARCH_API_KEY')\n    index_name = os.environ.get('AZURE_AI_SEARCH_INDEX_NAME', 'your-default-index')\n\n    if endpoint == 'https://example.search.windows.net' or api_key == 'YOUR_AI_SEARCH_API_KEY':\n        print(\"WARNING: Azure AI Search credentials or endpoint not set. Using placeholder values.\")\n        print(\"Please set AZURE_AI_SEARCH_ENDPOINT and AZURE_AI_SEARCH_API_KEY environment variables.\")\n        return\n\n    # Temporarily set environment variables for quickstart if not already present\n    # In a real application, set them once before running.\n    os.environ['AZURE_AI_SEARCH_ENDPOINT'] = endpoint\n    os.environ['AZURE_AI_SEARCH_API_KEY'] = api_key\n    os.environ['AZURE_AI_SEARCH_INDEX_NAME'] = index_name\n\n    try:\n        # Create an instance of the Azure AI Search tool\n        search_tool = AzureAISearch()\n\n        # Example of invoking the tool directly (as an agent might)\n        print(f\"Searching for 'Python programming language':\")\n        result = await search_tool.invoke(query='Python programming language', index_name=index_name)\n        print(f\"Search Result: {result[:500]}...\") # Truncate for display\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\n    finally:\n        # Clean up temporary environment variables\n        if 'AZURE_AI_SEARCH_ENDPOINT' in os.environ: del os.environ['AZURE_AI_SEARCH_ENDPOINT']\n        if 'AZURE_AI_SEARCH_API_KEY' in os.environ: del os.environ['AZURE_AI_SEARCH_API_KEY']\n        if 'AZURE_AI_SEARCH_INDEX_NAME' in os.environ: del os.environ['AZURE_AI_SEARCH_INDEX_NAME']\n\nif __name__ == '__main__':\n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates how to initialize the `AzureAISearch` tool and invoke it directly. It highlights the required environment variables for authentication and target index, and shows how to perform a search query. For full integration, this tool would be passed to an `Agent` instance from `agent-framework-core`."},"warnings":[{"fix":"Pin your dependency to an exact version (`agent-framework-azure-ai-search==X.Y.Z`) and review changelogs or GitHub releases frequently when upgrading.","message":"As a beta library, `agent-framework-azure-ai-search` is subject to frequent breaking changes. API signatures, class names, or configuration methods may change without a major version bump, following the active development of the broader Agent Framework.","severity":"breaking","affected_versions":"All beta versions (e.x., 1.0.0bX)"},{"fix":"Ensure `AZURE_AI_SEARCH_ENDPOINT` (your Azure AI Search service URL) and `AZURE_AI_SEARCH_API_KEY` (an admin API key) are correctly set in your environment before initializing the `AzureAISearch` tool. Optionally, set `AZURE_AI_SEARCH_INDEX_NAME` for a default index.","message":"Incorrect or missing environment variables for Azure AI Search (`AZURE_AI_SEARCH_ENDPOINT`, `AZURE_AI_SEARCH_API_KEY`) are common causes of runtime errors. The tool relies on these for authentication.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always install `agent-framework-core` and `agent-framework-azure-ai-search` in compatible versions. Refer to the `pyproject.toml` for specific version requirements of `agent-framework-core`.","message":"This package is part of the Microsoft Agent Framework ecosystem. Compatibility issues can arise if the `agent-framework-core` dependency is not aligned with the version expected by this package. The specified dependency is `agent-framework-core>=1.0.0b240327`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[],"ecosystem":"pypi"}