{"id":1907,"date":"2025-12-07T02:55:00","date_gmt":"2025-12-07T10:55:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/foundry\/?p=1907"},"modified":"2025-12-08T01:28:42","modified_gmt":"2025-12-08T09:28:42","slug":"foundry-iq-agent-framework-integration","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/foundry\/foundry-iq-agent-framework-integration\/","title":{"rendered":"Foundry IQ in Microsoft Agent Framework"},"content":{"rendered":"<h2>Executive Summary<\/h2>\n<p><strong>~20 lines of Python. Enterprise-grade RAG. Powered by Foundry IQ.<\/strong><\/p>\n<p>The Azure AI Search Context Provider in the Microsoft Agent Framework brings <strong>Foundry IQ<\/strong>\u2014Microsoft&#8217;s intelligent knowledge layer\u2014directly to your AI agents. Foundry IQ treats retrieval as a reasoning task, not just a keyword lookup or vector search, enabling agents to plan queries, follow chains of information, and synthesize answers across diverse sources.<\/p>\n<hr \/>\n<h2>The Problem with Traditional RAG<\/h2>\n<p><strong>Traditional RAG puts a heavy tax on every project.<\/strong> Every team rebuilds data connections, chunking logic, embeddings, routing, and permissions from scratch. It leaves organizations with fragmented, duplicated pipelines all trying to answer the same question: <em>what context does the model need to respond effectively?<\/em><\/p>\n<p><strong>Foundry IQ shifts that work into Knowledge Bases.<\/strong> Instead of wiring retrieval logic into every agent, you define a reusable Knowledge Base and connect. Behind the scenes, Foundry IQ handles indexing, vectorization, query planning, and multi-source routing.<\/p>\n<p>The result: getting started feels like <em>&#8220;plug in the domain knowledge this agent should have&#8221;<\/em> rather than <em>&#8220;rebuild a RAG stack.&#8221;<\/em><\/p>\n<hr \/>\n<h2>Quick Start<\/h2>\n<p><strong>Prerequisites:<\/strong> Azure AI Search service, Azure AI Foundry project, Python 3.10+. <a href=\"https:\/\/github.com\/microsoft\/agent-framework\/tree\/main\/python\/samples\/getting_started\/context_providers\/azure_ai_search\">See samples \u2192<\/a><\/p>\n<p>Install the package:<\/p>\n<pre><code class=\"language-bash\">pip install agent-framework-azure-ai-search --pre<\/code><\/pre>\n<p>Build a RAG agent with Foundry IQ in ~20 lines. This example uses <strong>agentic mode<\/strong>, which leverages Foundry IQ Knowledge Bases for intelligent, multi-hop retrieval:<\/p>\n<pre><code class=\"language-python\">import asyncio\r\nfrom agent_framework import ChatAgent\r\nfrom agent_framework.azure import AzureAIAgentClient, AzureAISearchContextProvider\r\nfrom azure.identity.aio import DefaultAzureCredential\r\n\r\nasync def main():\r\n    # Use managed identity for secure, keyless authentication\r\n    credential = DefaultAzureCredential()\r\n\r\n    async with (\r\n        # Connect to Foundry IQ Knowledge Base for agentic retrieval\r\n        AzureAISearchContextProvider(\r\n            endpoint=\"YOUR_SEARCH_ENDPOINT\",\r\n            knowledge_base_name=\"YOUR_KNOWLEDGE_BASE\",\r\n            credential=credential,\r\n            mode=\"agentic\",\r\n        ) as search,\r\n        # Connect to Azure AI Foundry for model inference\r\n        AzureAIAgentClient(\r\n            project_endpoint=\"YOUR_PROJECT_ENDPOINT\",\r\n            model_deployment_name=\"YOUR_MODEL\",\r\n            async_credential=credential,\r\n        ) as client,\r\n        # Create an agent grounded in your Knowledge Base\r\n        ChatAgent(chat_client=client, context_providers=[search]) as agent,\r\n    ):\r\n        print((await agent.run(\"What's in the knowledge base?\")).text)\r\n\r\nasyncio.run(main())<\/code><\/pre>\n<p>That&#8217;s it. Your agent now has access to enterprise knowledge with intelligent retrieval.<\/p>\n<hr \/>\n<h2>What is the Microsoft Agent Framework?<\/h2>\n<p>The <a href=\"https:\/\/aka.ms\/agent-framework\">Microsoft Agent Framework<\/a> is an open-source, model-agnostic engine for building agentic AI applications. It provides:<\/p>\n<ul>\n<li><strong>Unified Agent Abstractions<\/strong>: A consistent API across LLM providers (Azure OpenAI, OpenAI, Anthropic, and more)<\/li>\n<li><strong>Context Providers<\/strong>: Pluggable components that inject relevant context into agent conversations<\/li>\n<li><strong>Tool Integration<\/strong>: A standardized way to give agents access to external capabilities<\/li>\n<li><strong>Protocol Support<\/strong>: Built-in support for Agent-to-Agent (A2A) and AG-UI protocols<\/li>\n<\/ul>\n<p>The framework is available for both Python and .NET, enabling developers to build agents that can reason, plan, and take actions across enterprise data.<\/p>\n<hr \/>\n<h2>What is Foundry IQ?<\/h2>\n<p><strong>Foundry IQ<\/strong> is Microsoft&#8217;s intelligent knowledge layer for AI agents, built on Azure AI Search. Instead of traditional RAG where one query hits one index once, Foundry IQ treats retrieval as a reasoning task:<\/p>\n<ul>\n<li><strong>Query Planning<\/strong>: An LLM analyzes your query and plans optimal sub-queries<\/li>\n<li><strong>Multi-hop Reasoning<\/strong>: Follows chains of information across documents<\/li>\n<li><strong>Answer Synthesis<\/strong>: Returns comprehensive context with citations<\/li>\n<li><strong>Knowledge Bases<\/strong>: A unified abstraction over multiple data sources that agents can query naturally<\/li>\n<\/ul>\n<p>Microsoft&#8217;s evaluations show up to 36% improvement in response relevance on complex multi-hop queries compared to traditional RAG approaches. <a href=\"https:\/\/aka.ms\/AISearch-KB-evals\">Learn more about Foundry IQ \u2192<\/a><\/p>\n<hr \/>\n<h2>Two Retrieval Modes<\/h2>\n<p>The <code>AzureAISearchContextProvider<\/code> supports two modes, so you can choose the right approach for your use case:<\/p>\n<table>\n<thead>\n<tr>\n<th>Aspect<\/th>\n<th>Semantic Mode<\/th>\n<th>Agentic Mode (Foundry IQ)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Speed<\/strong><\/td>\n<td>Fast<\/td>\n<td>Slower (includes query planning)<\/td>\n<\/tr>\n<tr>\n<td><strong>Accuracy<\/strong><\/td>\n<td>Good for simple queries<\/td>\n<td>Excellent for complex queries<\/td>\n<\/tr>\n<tr>\n<td><strong>Query Complexity<\/strong><\/td>\n<td>Single-hop lookups<\/td>\n<td>Multi-hop reasoning<\/td>\n<\/tr>\n<tr>\n<td><strong>Best For<\/strong><\/td>\n<td>Speed-critical applications<\/td>\n<td>Research\/analytical understanding tasks<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>Semantic Mode<\/h3>\n<p>Fast <a href=\"https:\/\/learn.microsoft.com\/azure\/search\/hybrid-search-overview\">hybrid search<\/a> combining vector similarity, keyword matching, and <a href=\"https:\/\/learn.microsoft.com\/azure\/search\/semantic-search-overview\">semantic reranking<\/a>. Great for straightforward queries where speed matters.<\/p>\n<pre><code class=\"language-python\">async with (\r\n    # Fast hybrid search on your index\r\n    AzureAISearchContextProvider(\r\n        endpoint=\"https:\/\/mysearch.search.windows.net\",\r\n        index_name=\"product-catalog\",\r\n        credential=credential,\r\n        mode=\"semantic\",  # Fast hybrid search\r\n        top_k=5,          # Return top 5 results\r\n    ) as search,\r\n    AzureAIAgentClient(\r\n        project_endpoint=\"YOUR_PROJECT_ENDPOINT\",\r\n        model_deployment_name=\"gpt-4o\",\r\n        async_credential=credential,\r\n    ) as client,\r\n    ChatAgent(\r\n        chat_client=client,\r\n        instructions=\"You help customers find products.\",\r\n        context_providers=[search],\r\n    ) as agent,\r\n):\r\n    response = await agent.run(\"What laptops do you have under $1000?\")\r\n    print(response.text)<\/code><\/pre>\n<hr \/>\n<h3>Agentic Mode (Foundry IQ)<\/h3>\n<p>Intelligent retrieval powered by Knowledge Bases. The engine plans, searches, evaluates, and iterates before returning context\u2014handling complex, multi-step questions that traditional RAG struggles with.<\/p>\n<p><strong>Already have an Azure AI Search index?<\/strong> No problem. The provider can auto-create a Knowledge Base from your existing index:<\/p>\n<pre><code class=\"language-python\">async with (\r\n    AzureAISearchContextProvider(\r\n        endpoint=\"https:\/\/mysearch.search.windows.net\",\r\n        index_name=\"legal-documents\",  # Your existing index\r\n        credential=credential,\r\n        mode=\"agentic\",                 # Foundry IQ intelligent retrieval\r\n        azure_openai_resource_url=\"https:\/\/myopenai.openai.azure.com\",  # Azure OpenAI only\r\n        model_deployment_name=\"gpt-4o\",\r\n        retrieval_reasoning_effort=\"medium\",  # Full query planning\r\n    ) as search,\r\n    # ... rest of setup\r\n):<\/code><\/pre>\n<blockquote><p><strong>Note:<\/strong> Foundry IQ currently supports Azure OpenAI models only. See <a href=\"https:\/\/learn.microsoft.com\/azure\/search\/agentic-retrieval-how-to-create-knowledge-base?tabs=rbac&amp;pivots=python\">supported models<\/a> for the latest list.<\/p><\/blockquote>\n<p><strong>Have a Knowledge Base already?<\/strong> Even simpler\u2014just reference it by name:<\/p>\n<pre><code class=\"language-python\">async with (\r\n    AzureAISearchContextProvider(\r\n        endpoint=\"https:\/\/mysearch.search.windows.net\",\r\n        knowledge_base_name=\"enterprise-kb\",  # No index_name needed\r\n        credential=credential,\r\n        mode=\"agentic\",\r\n    ) as search,\r\n    # ... rest of setup\r\n):<\/code><\/pre>\n<hr \/>\n<h2>Configuration Options<\/h2>\n<h3>Retrieval Reasoning Effort<\/h3>\n<p>Control how much work the Foundry IQ engine does when planning queries:<\/p>\n<table>\n<thead>\n<tr>\n<th>Level<\/th>\n<th>Description<\/th>\n<th>Use Case<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>minimal<\/code><\/td>\n<td>Basic query, no decomposition<\/td>\n<td>Simple lookups<\/td>\n<\/tr>\n<tr>\n<td><code>low<\/code><\/td>\n<td>Light reasoning<\/td>\n<td>Moderate complexity<\/td>\n<\/tr>\n<tr>\n<td><code>medium<\/code><\/td>\n<td>Full query planning<\/td>\n<td>Complex multi-hop queries<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Output Modes<\/h3>\n<table>\n<thead>\n<tr>\n<th>Mode<\/th>\n<th>Description<\/th>\n<th>Use Case<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>extractive_data<\/code><\/td>\n<td>Returns raw document chunks<\/td>\n<td>Agent handles synthesis<\/td>\n<\/tr>\n<tr>\n<td><code>answer_synthesis<\/code><\/td>\n<td>Knowledge Base synthesizes answer<\/td>\n<td>Direct Q&amp;A systems<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>Get Started<\/h2>\n<ul>\n<li><strong>Install<\/strong>: <code>pip install agent-framework-azure-ai-search --pre<\/code><\/li>\n<li><strong>Docs<\/strong>: <a href=\"https:\/\/github.com\/microsoft\/agent-framework\/tree\/main\/python\/samples\/getting_started\/context_providers\/azure_ai_search\">Azure AI Search Context Provider documentation<\/a><\/li>\n<li><strong>Video<\/strong>: <a href=\"https:\/\/youtu.be\/bHL1jbWjJUc?si=I4FgUT_EHL9CkQfa\">Foundry IQ for multi-source AI knowledge bases<\/a><\/li>\n<li><strong>Demo App<\/strong>: <a href=\"https:\/\/aka.ms\/foundry-iq-demo\">Knowledge Bases and agentic RAG<\/a><\/li>\n<\/ul>\n<hr \/>\n<h2>Summary<\/h2>\n<p>The Azure AI Search Context Provider bridges the Microsoft Agent Framework and Foundry IQ. It enables your agents to:<\/p>\n<ul>\n<li>Access enterprise knowledge through a standardized context provider<\/li>\n<li>Choose the right retrieval strategy (semantic vs agentic) based on your use case<\/li>\n<li>Leverage Foundry IQ&#8217;s intelligence for complex, multi-hop reasoning<\/li>\n<li>Scale with enterprise requirements using managed identity and built-in governance<\/li>\n<\/ul>\n<p><strong>~20 lines of Python. Enterprise-grade RAG. Powered by Foundry IQ.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Build enterprise-grade RAG agents with Foundry IQ Knowledge Bases in ~20 lines of Python. Learn how the Azure AI Search Context Provider brings intelligent, multi-hop retrieval to the Microsoft Agent Framework\u2014no fragmented pipelines, just plug in the knowledge your agent needs.<\/p>\n","protected":false},"author":170596,"featured_media":1563,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[87,90,13,12,92,93,86,88,89,91],"class_list":["post-1907","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-foundry","tag-agent-framework","tag-agentic-ai","tag-azure-ai-search","tag-azure-openai","tag-context-providers","tag-enterprise-knowledge","tag-foundry-iq","tag-knowledge-bases","tag-rag","tag-semantic-search"],"acf":[],"blog_post_summary":"<p>Build enterprise-grade RAG agents with Foundry IQ Knowledge Bases in ~20 lines of Python. Learn how the Azure AI Search Context Provider brings intelligent, multi-hop retrieval to the Microsoft Agent Framework\u2014no fragmented pipelines, just plug in the knowledge your agent needs.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/posts\/1907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/users\/170596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/comments?post=1907"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/posts\/1907\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/media\/1563"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/media?parent=1907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/categories?post=1907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/tags?post=1907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}