Content
# Agentic Protocols
## Overview
Applications that use agents to implement functionality can communicate with those agents using multiple protocols, each with distinct advantages:

- **Google's Agent to Agent protocol (A2A)** - Provides a standardized framework for inter-agent communication, enabling agents to collaborate and share information efficiently
- **Anthropic's Model Context Protocol (MCP)** - Offers a flexible approach for integrating external tools and data sources into AI agents, making it particularly well-suited for extending agent capabilities
- **OpenAI's chat completion model** - Provides a straightforward, widely-adopted interface for conversational AI interactions with robust streaming and function calling support
- **Microsoft Foundry's communication format** - Delivers enterprise-grade agent hosting with native Azure integration
The choice of protocol depends on specific requirements such as interoperability needs, tooling ecosystem, deployment environment, and the level of control required over agent interactions.

The Microsoft Agent Framework in combination with ASP.NET makes it easy to implement any of these agent protocols. By providing a unified agent abstraction layer and leveraging ASP.NET's web hosting capabilities, developers can quickly expose the same agent logic through a dedicated protocol or even multiple protocols simultaneously.
## Repo Content
This repository provides dedicated sample implementations for each agent protocol, demonstrating how to build agents using MCP, A2A, OpenAI, and Foundry native formats. Additionally, it includes a unified project (Hosting.Unified) that showcases how the same agent can simultaneously expose its functionality through all four protocols—MCP, A2A, OpenAI, and Foundry native—enabling maximum flexibility and allowing different clients to interact with the agent using their preferred communication method.
| Protocol | Project | Description |
|----------|---------|-------------|
| **MCP** | [src/Hosting.MCP](src/Hosting.MCP) | Implements the Model Context Protocol for tool integration |
| **A2A** | [src/Hosting.A2A](src/Hosting.A2A) | Implements Google's Agent to Agent protocol for inter-agent communication |
| **OpenAI** | [src/Hosting.OpenAI](src/Hosting.OpenAI) | Exposes agent using OpenAI's chat completion API format |
| **Foundry Native** | [src/Hosting.AzureNative](src/Hosting.AzureNative) | Implements Microsoft Foundry's native agent hosting format |
| **Unified** | [src/Hosting.Unified](src/Hosting.Unified) | Single agent exposed simultaneously through all four protocols |
## Agent Functionality
The agent implemented in [AgentFactory.cs](./src/Hosting.Unified/AgentFactory.cs) simulates a sport kiosk that provides information about a fictitious "Super Sports Championship" event. The agent uses a Retrieval-Augmented Generation (RAG) pattern through the `TextSearchProvider`, which retrieves relevant information from a simulated knowledge base before generating responses. When users ask about event results, the agent queries the grounding data source to find information about the winner (Munich Flying Dolphins - 27:31) or general championship details.
## Testing
The [test](test) folder contains HTTP test scripts for each protocol implementation, allowing to verify and interact with the agents.
Test scripts are available for [MCP](test/Hosting.MCP.http), [A2A](test/Hosting.A2A.http), [OpenAI](test/Hosting.OpenAI.http), [Foundry Native](test/Hosting.AzureNative.http), and the [Unified](test/Hosting.Unified.http) implementation.
## Azure Environment
The agent defined in [AgentFactory.cs](./src/Hosting.Unified/AgentFactory.cs) uses Azure OpenAI to provide its functionality.
Configuration settings including the Azure OpenAI endpoint, API key, and the name of a deployed chat completion model can be specified in the [conf/conf.env](conf/conf.env) file.
Alternatively, the [setup/setup.azcli](setup/setup.azcli) PowerShell Azure CLI script can be used to automatically create the necessary Azure environment with all required resources.