Foundry IQ – Agentic retrieval solution – part 1

Context

In this blog post, we are going to explore how to leverage Azure AI search and Microsoft Foundry to create an end-to-end retrieval pipeline. Agentic retrieval is a design pattern intended for Retrieval Augumented Generation (RAG) scenarios as well as agent-to-agent workflows.

With Azure AI search you can now leverage the new multi-query pipeline designed for complex questions posed by users or agents in chat and copilot apps.

Using a sample end-to-end solution, complete with screenshots, I will walk you through creating this Foundry IQ solution.

What is Foundry IQ

Foundry IQ creates a separation of concerns between domain knowledge and agent logic, enabling retrieval-augmented generation (RAG) and grounding at scale. Instead of bundling retrieval complexity into each agent, you create a knowledge base that represents a complete domain of knowledge, such as human resources or sales. Your agents then call the knowledge base to ground their responses in relevant, up-to-date information.

This separation has two key benefits:

  • Multiple agents can share the same knowledge base, avoiding duplicate configurations.
  • You can independently update a knowledge base without modifying agents.

Powered by Azure AI Search, Foundry IQ consists of knowledge sources (what to retrieve) and knowledge bases (how to retrieve). The knowledge base plans and executes subqueries and outputs formatted results with citations.

High level architecture

The diagram shown above shows a high-level architecture of a Foundry IQ solution. The elements of the architecture are explained below.

1. Your App

This your agentic application, a conversational application that require complex reasoning over large knowledge domains

2. Foundry Agent Service

Microsoft Foundry is your one-stop shop for hosting your Azure OpenAI model deployments, project creations and agents

3. Azure AI Search

Azure AI Search is a fully managed, cloud-hosted service that connects your data to AI. It hosts the knowledge base, which handles query planning, query execution and results synthesis

Microsoft Foundry project setup

Follow the following steps to setup a Microsoft Foundry project

  1. Navigate and login to your Azure portal subscription.
  2. Search and select Microsoft Foundry
    • Azure portal Microsoft Foundry resource
  3. On the Microsoft Foundry overview page, select Create a resource
  4. Specify the Subscription details, Resource group to use, the Foundry Resource name, Region as well as Foundry Project name. Ensure you use the recommended naming conventions and best practices for your resources. Also ensure the Region selected supports Azure AI Search.
    • Below is Basics dialog page
    • Below is the Storage dialog page. You will notice I have created new CosmosDB, AI Search and Storage account for my Foundry project.
    • On the Identity dialog page, ensure you Enable a system-assigned managed identity for both your search service and your project.
    • Review and Create the Foundry Resources and Project. This may take a short while to complete
    • When completed, you will see confirmation page below. You can then view the resources using Got to resource button
  5. Go to resource will redirect to the Microsoft Foundry portal as shown below.
    • This is where to retrieve key settings that we will be using in this solution. Such as the following
      • AZURE_SEARCH_ENDPOINT is on the Overview page of your search service.
      • PROJECT_ENDPOINT is on the Endpoints page of your project.
      • PROJECT_RESOURCE_ID is on the Properties page of your project.
      • AZURE_OPENAI_ENDPOINT is on the Endpoints page of your project’s parent resource.
  6. On your search service, enable role-based access and assign the following roles. First, navigate to the Keys section and enable role-based access control
    • Then assign these roles shown below
RoleAssigneePurpose
Search Service ContributorYour user accountCreate objects
Search Index Data ContributorYour user accountLoad data
Search Index Data ReaderYour user account and project managed identityRead indexed content

On your project’s parent resource, assign the following roles.

RoleAssigneePurpose
Azure AI UserYour user accountAccess model deployments and create agents
Azure AI Project ManagerYour user accountCreate project connection and use MCP tool in agents
Cognitive Services UserSearch service managed identityAccess knowledge base

Local Dev environment setup

We will be using Python in this sample solution. I presume you already have Python installed in your development environment.

To verify Python is setup and working correctly, open your command line tool and type the following commands:

Bash
# Check the Python version.
python3 --version
# Check the pip version.
pip3 --version

If you are on Ubuntu, you should see similar output as my screenshot below:

Follow the steps provided in the README file in my accompanying source code repository for steps on how to set up your local a virtual environment. When successful, your ai-agentic-retrieval.ipynb Jupyter Notebook should look like the one shown below:

Source code repository

You can access the source code used in this solution from my GitHub repository.

Next steps

In this blog post, we looked at a Foundry IQ – Agentic retrieval solution. We started with a high-level architecture and the various elements within the Foundry IQ solution. I also walked you through the process of creating a project within Microsoft Foundry and configured access needed. I also shared steps of preparing your local development environment, ready for the Foundry IQ solution. In the follow-up blog post, we will deep dive into the end-to-end solution, including a walk through of the source code.

Stay tuned for future posts, feel free to leave us comments and feedback as well.

Everything AI – RAG, MCP, A2A integration architectures

Context

In this blog post, we are going to explore Agentic AI prominent integration architectures. We are going to discuss RAG, MCP and A2A architectures. If you are not familiar with these terminologies, don’t worry as you are in good company. Let us begin with how we got here in the first place.

What is an Agentic AI?

An AI agent is a system designed to pursue a goal autonomously by combining perception, reasoning, action, and memory. Often built using a large language model (LLM) and integrated with external tools. These agents perceive inputs, reason about what to do, act on those plans, and whilst also remembering any past interactions (memory).

We will now expound more on some of the key words below:

  • Perception – this is how your agent recognises or receives inputs such as a user prompt or some event occurring
  • Reasoning – this is the capability to break down a goal or objective into individual steps, identify which tools to use and adapt plans. This will usually be powered by an LLM
  • Tool – is any external system the agent can call or interact with, such as an API call or a database
  • Action – is the execution of the plan or decision by the agent, the act of sending an email for example, or submitting a form. Agent will perform the action leveraging the tools

What is Retrieval Augmented Generation (RAG)?

Carrying on with our AI agent conversation, suppose we need to empower our agent with deep, factual knowledge of a particular domain. Then RAG is the architectural pattern to use. As an analogy, think of RAG as an expert with instant access to your particular domain knowledge.

This pattern allows us to connect an LLM to an external knowledge source, which is typically a vector database. Therefore, the agent’s prompts are then “augmented” with this more relevant, retrieved data before the final response is generated.

Key benefit

With RAG, agents drastically reduces “noise” or “hallucinations” ensuring that the responses and answers are based on specific and latest domain knowledge or enterprise data

Some use cases

  • Q&A scenarios over Enterprise Knowledge – think of an HR agent that answers employee questions by referencing HR policy documents. Ensures the answers are accurate and citations of policies
  • Legal Team agent – that analyses company data rooms, summarizing risks and cross-referencing findings with internal documents and playbooks

What is Model Context Protocol (MCP)?

MCP is an open-source standard for connecting AI applications to external systems. As an analogy, think of MCP as a highly skilled employee who knows exactly which department (API) to call for a particular task.

MCP architecture, adapted from: https://modelcontextprotocol.io/docs/getting-started/intro

This is an emerging standard for enabling agents to discover and interact with external systems (APIs) in a structured and also predicable manner. It is like a USB-C for AI agents

Key benefit

MCP provides a governable, secure and standardized way for our agents to take action and interact with enterprise systems, doing more and going beyond simple data retrieval as in the use cases for RAG

Some use cases

  • Self-service sales agent – think of a Sales agent that allows a salesperson to create a new opportunity in a company CRM, then set up and add standard follow-up tasks as required. The agent does discovery of available CRM APIs, understand the required parameters and executes the transactions securely.
  • An accounting agent – think of automated financial operations where upon receiving an invoice in a email inbox, the agent calls the ERP system to create a draft bill, match it to Purchase Order and schedule a payment.

What is Agent-to-Agent (A2A)?

This does what is says on the tin. Multiple, specialized or utility agents collaborate to solve a problem that is too complex for a single agent. The graphic below illustrates this collaboration. As an analogy, think of a team of specialists collaborating on a complex project.

Key benefit

A2A enables tackling highly complex, multi-domain problems by leveraging specialized skills, similar to a human workforce.

Some use cases

  • Autonomous product development team – think of an autonomous product development teams consisting of “PM agent”, “Developer agent”, “QA agent” all working together. PM writes specs, Developer writes code and QA tests the code, iterating until a feature is completed. Specialization means agents can achieve higher quality of outputs at each stage of a complex workflow.

So which is it, RAG, MCP or A2A?

As architects we often rely on rubrics when we need to make architectural decisions. With Agent AI solutions, you can use a set of guidelines that best helps you assess the business domain problem and come up with the right solution. Below is an example rubric to help with your assessments and criteria when to leverage RAG, MCP or A2A.

Start with a goal

Agentic AI solutions are not any different. There is no “one size fits all” solutions. Always start with a goal, business objective so you can map the right Agentic AI solution for it. Sometimes Agentic AI many not be the right solution at all, don’t just jump on the bandwagon.

Trends and road ahead

Agentic AI is at very early stages and expect more emergence patterns in coming days and months. We may need to combine RAG and MCP and leverage a hybrid approach to solving AI problems. We already seeing the most valuable enterprise agents are not pure RAG or MCP but a hybrid.

Next steps

In this blog post, we looked at prominent integration architectures in this age of Agent AI. We explored RAG, MCP and A2A architectural patterns. We also looked at some of the use cases for each as well as key benefits we get from each pattern. We finished with a sample architecture rubric that can be leveraged.

Stay tuned for future posts, feel free to leave us comments and feedback as well.