December 7th, 2025
0 reactions

Foundry IQ in Microsoft Agent Framework

Executive Summary

~20 lines of Python. Enterprise-grade RAG. Powered by Foundry IQ.

The Azure AI Search Context Provider in the Microsoft Agent Framework brings Foundry IQ—Microsoft’s intelligent knowledge layer—directly 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.


The Problem with Traditional RAG

Traditional RAG puts a heavy tax on every project. 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: what context does the model need to respond effectively?

Foundry IQ shifts that work into Knowledge Bases. 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.

The result: getting started feels like “plug in the domain knowledge this agent should have” rather than “rebuild a RAG stack.”


Quick Start

Prerequisites: Azure AI Search service, Azure AI Foundry project, Python 3.10+. See samples →

Install the package:

pip install agent-framework-azure-ai-search --pre

Build a RAG agent with Foundry IQ in ~20 lines. This example uses agentic mode, which leverages Foundry IQ Knowledge Bases for intelligent, multi-hop retrieval:

import asyncio
from agent_framework import ChatAgent
from agent_framework.azure import AzureAIAgentClient, AzureAISearchContextProvider
from azure.identity.aio import DefaultAzureCredential

async def main():
    # Use managed identity for secure, keyless authentication
    credential = DefaultAzureCredential()

    async with (
        # Connect to Foundry IQ Knowledge Base for agentic retrieval
        AzureAISearchContextProvider(
            endpoint="YOUR_SEARCH_ENDPOINT",
            knowledge_base_name="YOUR_KNOWLEDGE_BASE",
            credential=credential,
            mode="agentic",
        ) as search,
        # Connect to Azure AI Foundry for model inference
        AzureAIAgentClient(
            project_endpoint="YOUR_PROJECT_ENDPOINT",
            model_deployment_name="YOUR_MODEL",
            async_credential=credential,
        ) as client,
        # Create an agent grounded in your Knowledge Base
        ChatAgent(chat_client=client, context_providers=[search]) as agent,
    ):
        print((await agent.run("What's in the knowledge base?")).text)

asyncio.run(main())

That’s it. Your agent now has access to enterprise knowledge with intelligent retrieval.


What is the Microsoft Agent Framework?

The Microsoft Agent Framework is an open-source, model-agnostic engine for building agentic AI applications. It provides:

  • Unified Agent Abstractions: A consistent API across LLM providers (Azure OpenAI, OpenAI, Anthropic, and more)
  • Context Providers: Pluggable components that inject relevant context into agent conversations
  • Tool Integration: A standardized way to give agents access to external capabilities
  • Protocol Support: Built-in support for Agent-to-Agent (A2A) and AG-UI protocols

The framework is available for both Python and .NET, enabling developers to build agents that can reason, plan, and take actions across enterprise data.


What is Foundry IQ?

Foundry IQ is Microsoft’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:

  • Query Planning: An LLM analyzes your query and plans optimal sub-queries
  • Multi-hop Reasoning: Follows chains of information across documents
  • Answer Synthesis: Returns comprehensive context with citations
  • Knowledge Bases: A unified abstraction over multiple data sources that agents can query naturally

Microsoft’s evaluations show up to 36% improvement in response relevance on complex multi-hop queries compared to traditional RAG approaches. Learn more about Foundry IQ →


Two Retrieval Modes

The AzureAISearchContextProvider supports two modes, so you can choose the right approach for your use case:

Aspect Semantic Mode Agentic Mode (Foundry IQ)
Speed Fast Slower (includes query planning)
Accuracy Good for simple queries Excellent for complex queries
Query Complexity Single-hop lookups Multi-hop reasoning
Best For Speed-critical applications Research/analytical understanding tasks

Semantic Mode

Fast hybrid search combining vector similarity, keyword matching, and semantic reranking. Great for straightforward queries where speed matters.

async with (
    # Fast hybrid search on your index
    AzureAISearchContextProvider(
        endpoint="https://mysearch.search.windows.net",
        index_name="product-catalog",
        credential=credential,
        mode="semantic",  # Fast hybrid search
        top_k=5,          # Return top 5 results
    ) as search,
    AzureAIAgentClient(
        project_endpoint="YOUR_PROJECT_ENDPOINT",
        model_deployment_name="gpt-4o",
        async_credential=credential,
    ) as client,
    ChatAgent(
        chat_client=client,
        instructions="You help customers find products.",
        context_providers=[search],
    ) as agent,
):
    response = await agent.run("What laptops do you have under $1000?")
    print(response.text)

Agentic Mode (Foundry IQ)

Intelligent retrieval powered by Knowledge Bases. The engine plans, searches, evaluates, and iterates before returning context—handling complex, multi-step questions that traditional RAG struggles with.

Already have an Azure AI Search index? No problem. The provider can auto-create a Knowledge Base from your existing index:

async with (
    AzureAISearchContextProvider(
        endpoint="https://mysearch.search.windows.net",
        index_name="legal-documents",  # Your existing index
        credential=credential,
        mode="agentic",                 # Foundry IQ intelligent retrieval
        azure_openai_resource_url="https://myopenai.openai.azure.com",  # Azure OpenAI only
        model_deployment_name="gpt-4o",
        retrieval_reasoning_effort="medium",  # Full query planning
    ) as search,
    # ... rest of setup
):

Note: Foundry IQ currently supports Azure OpenAI models only. See supported models for the latest list.

Have a Knowledge Base already? Even simpler—just reference it by name:

async with (
    AzureAISearchContextProvider(
        endpoint="https://mysearch.search.windows.net",
        knowledge_base_name="enterprise-kb",  # No index_name needed
        credential=credential,
        mode="agentic",
    ) as search,
    # ... rest of setup
):

Configuration Options

Retrieval Reasoning Effort

Control how much work the Foundry IQ engine does when planning queries:

Level Description Use Case
minimal Basic query, no decomposition Simple lookups
low Light reasoning Moderate complexity
medium Full query planning Complex multi-hop queries

Output Modes

Mode Description Use Case
extractive_data Returns raw document chunks Agent handles synthesis
answer_synthesis Knowledge Base synthesizes answer Direct Q&A systems

Get Started


Summary

The Azure AI Search Context Provider bridges the Microsoft Agent Framework and Foundry IQ. It enables your agents to:

  • Access enterprise knowledge through a standardized context provider
  • Choose the right retrieval strategy (semantic vs agentic) based on your use case
  • Leverage Foundry IQ’s intelligence for complex, multi-hop reasoning
  • Scale with enterprise requirements using managed identity and built-in governance

~20 lines of Python. Enterprise-grade RAG. Powered by Foundry IQ.

Author

Farzad Sunavala
Principal Product Manager

Building knowledge retrieval capabilities for AI Agents.

Eduard van Valkenburg
Senior Software Engineer

Senior Software Engineer - Semantic Kernel Python

0 comments