{"id":4967,"date":"2025-07-21T01:10:23","date_gmt":"2025-07-21T08:10:23","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/semantic-kernel\/?p=4967"},"modified":"2025-07-21T01:10:23","modified_gmt":"2025-07-21T08:10:23","slug":"guest-blog-building-multi-agent-solutions-with-semantic-kernel-and-a2a-protocol","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/agent-framework\/guest-blog-building-multi-agent-solutions-with-semantic-kernel-and-a2a-protocol\/","title":{"rendered":"Guest Blog: Building Multi-Agent Solutions with Semantic Kernel and A2A Protocol"},"content":{"rendered":"<p>In the rapidly evolving landscape of AI application development, the ability to orchestrate multiple intelligent agents has become crucial for building sophisticated, enterprise-grade solutions. While individual AI agents excel at specific tasks, complex business scenarios often require coordination between specialized agents running on different platforms, frameworks, or even across organizational boundaries. This is where the combination of Microsoft&#8217;s Semantic Kernel orchestration capabilities and Agent-to-Agent (A2A) protocol creates a powerful foundation for building truly interoperable multi-agent systems.<\/p>\n<h2 id=\"understanding-the-a2a-protocol-beyond-traditional-tool-integration\" class=\"code-line\" dir=\"auto\" data-line=\"4\">Understanding the A2A Protocol: Beyond Traditional Tool Integration<\/h2>\n<p class=\"code-line\" dir=\"auto\" data-line=\"6\">The Agent-to-Agent (A2A) protocol, introduced by Google in April 2025 with support from over 50 technology partners, addresses a fundamental challenge in the AI ecosystem: enabling intelligent agents to communicate and collaborate as peers, not just as tools. Unlike protocols like MCP (Model Context Protocol) that focus on connecting agents to external tools and data sources, A2A establishes a standardized communication layer specifically designed for agent-to-agent interaction.<\/p>\n<h3 id=\"core-a2a-capabilities\" class=\"code-line\" dir=\"auto\" data-line=\"8\">Core A2A Capabilities<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"10\">The A2A protocol is built around four fundamental capabilities that enable sophisticated agent collaboration:<\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"12\"><strong>1. Agent Discovery through Agent Cards<\/strong>\u00a0Every A2A-compliant agent exposes a machine-readable &#8220;Agent Card&#8221; \u2014 a JSON document that advertises its capabilities, endpoints, supported message types, authentication requirements, and operational metadata. This discovery mechanism allows client agents to dynamically identify and select the most appropriate remote agent for specific tasks.<\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"15\"><strong>2. Task Management with Lifecycle Tracking<\/strong>\u00a0A2A structures all interactions around discrete &#8220;tasks&#8221; that have well-defined lifecycles. Tasks can be completed immediately or span extended periods with real-time status updates, making the protocol suitable for everything from quick API calls to complex research operations that may take hours or days.<\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"18\"><strong>3. Rich Message Exchange<\/strong>\u00a0Communication occurs through structured messages containing &#8220;parts&#8221; with specified content types. This enables agents to negotiate appropriate interaction modalities and exchange diverse data types including text, structured JSON, files, and even multimedia streams.<\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"21\"><strong>4. Enterprise-Grade Security<\/strong>\u00a0Built on familiar web standards (HTTP, JSON-RPC 2.0, Server-Sent Events), A2A incorporates enterprise-grade authentication and authorization with support for OpenAPI authentication schemes, ensuring secure collaboration without exposing internal agent state or proprietary tools.<\/p>\n<h3 id=\"a2a-vs-mcp-complementary-rather-than-competing\" class=\"code-line\" dir=\"auto\" data-line=\"24\">A2A vs. MCP: Complementary Rather Than Competing<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"26\">A common misconception is that A2A competes with Anthropic&#8217;s Model Context Protocol (MCP). In reality, these protocols address different layers of the agentic AI stack:<\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"28\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"28\"><strong>MCP connects agents to tools and data<\/strong>\u00a0\u2014 enabling access to external APIs, databases, file systems, and other structured resources<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"29\"><strong>A2A connects agents to other agents<\/strong>\u00a0\u2014 enabling peer-to-peer collaboration, task delegation, and distributed problem-solving<\/li>\n<\/ul>\n<p class=\"code-line\" dir=\"auto\" data-line=\"31\">Think of it as the difference between giving an agent a hammer (MCP) versus teaching it to work with a construction crew (A2A). Most sophisticated applications will leverage both protocols.<\/p>\n<h2 id=\"semantic-kernel-the-orchestration-engine\" class=\"code-line\" dir=\"auto\" data-line=\"33\">Semantic Kernel: The Orchestration Engine<\/h2>\n<p class=\"code-line\" dir=\"auto\" data-line=\"35\">Microsoft&#8217;s Semantic Kernel provides the ideal foundation for building A2A-enabled multi-agent systems. As an open-source SDK, Semantic Kernel excels at:<\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"37\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"37\"><strong>Plugin-Based Architecture<\/strong>: Easily extending agent capabilities through reusable plugins<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"38\"><strong>Multi-Model Support<\/strong>: Orchestrating different AI models for specialized tasks<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"39\"><strong>Enterprise Integration<\/strong>: Seamlessly connecting with existing enterprise systems and APIs<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"40\"><strong>Agent Framework<\/strong>: Providing experimental but powerful multi-agent coordination capabilities<\/li>\n<\/ul>\n<h3 id=\"why-semantic-kernel--a2a\" class=\"code-line\" dir=\"auto\" data-line=\"42\">Why Semantic Kernel + A2A?<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"44\">The integration of Semantic Kernel with A2A protocol creates several compelling advantages:<\/p>\n<ol class=\"code-line\" dir=\"auto\" data-line=\"46\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"46\"><strong>Framework Agnostic Interoperability<\/strong>: Semantic Kernel agents can communicate with agents built using LangGraph, CrewAI, Google&#8217;s ADK, or any other A2A-compliant framework<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"47\"><strong>Retained Semantic Kernel Benefits<\/strong>: Leverage SK&#8217;s plugin ecosystem, prompt engineering capabilities, and enterprise features while gaining cross-platform compatibility<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"48\"><strong>Gradual Migration Path<\/strong>: Existing Semantic Kernel applications can incrementally adopt A2A without major architectural changes<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"49\"><strong>Cloud-Native Design<\/strong>: Built for enterprise scenarios with proper authentication, logging, and observability<\/li>\n<\/ol>\n<h2 id=\"architecture-patterns-for-a2a-enabled-systems\" class=\"code-line\" dir=\"auto\" data-line=\"51\">Architecture Patterns for A2A-Enabled Systems<\/h2>\n<p class=\"code-line\" dir=\"auto\" data-line=\"53\">When designing multi-agent systems with Semantic Kernel and A2A, the architecture from our implementation demonstrates several key patterns:<\/p>\n<h3 id=\"1-centralized-routing-with-azure-ai-foundry\" class=\"code-line\" dir=\"auto\" data-line=\"55\">1. Centralized Routing with Azure AI Foundry<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"57\">Our primary pattern uses a central routing agent powered by Azure AI Foundry to intelligently delegate tasks to specialized remote agents:<\/p>\n<p dir=\"auto\" data-line=\"57\"><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/arch.png\"><img decoding=\"async\" class=\"alignnone wp-image-4973\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/arch-300x264.png\" alt=\"arch image\" width=\"555\" height=\"488\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/arch-300x264.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/arch-1024x900.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/arch-768x675.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/arch.png 1042w\" sizes=\"(max-width: 555px) 100vw, 555px\" \/><\/a><\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"63\"><strong>Key Components:<\/strong><\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"64\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"64\"><strong>Host Agent<\/strong>: Central routing system using Azure AI Agents for intelligent decision-making<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"65\"><strong>A2A Protocol<\/strong>: Standardized agent-to-agent communication<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"66\"><strong>Semantic Kernel<\/strong>: Advanced agent framework with MCP integration<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"67\"><strong>Remote Agents<\/strong>: Specialized task executors with different communication protocols<\/li>\n<\/ul>\n<p class=\"code-line\" dir=\"auto\" data-line=\"69\"><strong>Benefits:<\/strong><\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"70\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"70\">Centralized conversation state management through Azure AI Foundry threads<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"71\">Intelligent task delegation based on agent capabilities and user intent<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"72\">Consistent user experience across diverse agent interactions<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"73\">Clear audit trail and comprehensive error handling<\/li>\n<\/ul>\n<h3 id=\"2-multi-protocol-agent-communication\" class=\"code-line\" dir=\"auto\" data-line=\"75\">2. Multi-Protocol Agent Communication<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"77\">The system demonstrates how different communication protocols can coexist:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM.png\"><img decoding=\"async\" class=\"alignnone wp-image-4976\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM-300x48.png\" alt=\"Screenshot 2025 07 18 at 8 50 16 PM image\" width=\"581\" height=\"93\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM-300x48.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM-1024x163.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM-768x122.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM-1536x244.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.50.16\u202fPM.png 1676w\" sizes=\"(max-width: 581px) 100vw, 581px\" \/><\/a><\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"86\"><strong>Communication Patterns:<\/strong><\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"87\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"87\"><strong>A2A HTTP\/JSON-RPC<\/strong>: For general-purpose tool agents with standardized discovery<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"88\"><strong>STDIO<\/strong>: For process-based agents like Playwright automation<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"89\"><strong>Server-Sent Events (SSE)<\/strong>: For serverless MCP functions in Azure<\/li>\n<\/ul>\n<h3 id=\"3-hybrid-mcp--a2a-integration\" class=\"code-line\" dir=\"auto\" data-line=\"91\">3. Hybrid MCP + A2A Integration<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"93\">Our architecture showcases how MCP and A2A protocols complement each other:<\/p>\n<p dir=\"auto\" data-line=\"93\"><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM.png\"><img decoding=\"async\" class=\"alignnone wp-image-4977\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM-300x27.png\" alt=\"Screenshot 2025 07 18 at 8 51 50 PM image\" width=\"544\" height=\"49\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM-300x27.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM-1024x91.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM-768x68.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM-1536x136.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.51.50\u202fPM.png 1826w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/a><\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"100\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"100\"><strong>MCP for Tools<\/strong>: Direct integration with Azure Functions, development tools, and data sources<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"101\"><strong>A2A for Agents<\/strong>: Inter-agent communication and task delegation<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"102\"><strong>Semantic Kernel<\/strong>: Orchestration layer that bridges both protocols<\/li>\n<\/ul>\n<h2 id=\"implementation-deep-dive\" class=\"code-line\" dir=\"auto\" data-line=\"104\">Implementation Deep Dive<\/h2>\n<h3 id=\"project-structure-and-components\" class=\"code-line\" dir=\"auto\" data-line=\"106\">Project Structure and Components<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"108\">Our multi-agent system follows a modular architecture:<\/p>\n<p dir=\"auto\" data-line=\"108\"><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM.png\"><img decoding=\"async\" class=\"alignnone wp-image-4975\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM-300x105.png\" alt=\"Screenshot 2025 07 18 at 8 48 46 PM image\" width=\"540\" height=\"189\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM-300x105.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM-1024x359.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM-768x269.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM-1536x539.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/07\/Screenshot-2025-07-18-at-8.48.46\u202fPM.png 1870w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/a><\/p>\n<h3 id=\"development-environment-setup\" class=\"code-line\" dir=\"auto\" data-line=\"125\">Development Environment Setup<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"127\">To build this A2A-enabled Semantic Kernel system, you&#8217;ll need:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># Initialize Python project with uv (recommended)\r\nuv init multi_agent_system\r\ncd multi_agent_system\r\n\r\n# Core dependencies for Semantic Kernel and Azure integration\r\nuv add semantic-kernel[azure]\r\nuv add azure-identity\r\nuv add azure-ai-agents\r\nuv add python-dotenv\r\n\r\n# A2A protocol dependencies\r\nuv add a2a-client\r\nuv add httpx\r\n\r\n# MCP integration dependencies\r\nuv add semantic-kernel[mcp]\r\n\r\n# Web interface dependencies\r\nuv add gradio\r\n\r\n# Development dependencies\r\nuv add --dev pytest pytest-asyncio<\/code><\/pre>\n<h3 id=\"environment-configuration\" class=\"code-line\" dir=\"auto\" data-line=\"154\">Environment Configuration<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"156\">Configure your environment variables:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># Azure AI Foundry configuration\r\nAZURE_AI_AGENT_ENDPOINT=https:\/\/your-ai-foundry-endpoint.azure.com\r\nAZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME=Your AI Foundry Model Deployment Name\r\n\r\n# Remote agent endpoints\r\nPLAYWRIGHT_AGENT_URL=http:\/\/localhost:10001\r\nTOOL_AGENT_URL=http:\/\/localhost:10002\r\n\r\n# Optional: MCP server configuration\r\nMCP_SSE_URL=http:\/\/localhost:7071\/runtime\/webhooks\/mcp\/sse<\/code><\/pre>\n<h3 id=\"creating-the-central-routing-agent\" class=\"code-line\" dir=\"auto\" data-line=\"171\">Creating the Central Routing Agent<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"173\">The heart of our system is the routing agent that uses Azure AI Foundry for intelligent task delegation:<\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">import json\r\nimport os\r\nimport time\r\nimport uuid\r\nfrom typing import Any, Dict, List\r\nimport httpx\r\nfrom a2a.client import A2ACardResolver\r\nfrom azure.ai.agents import AgentsClient\r\nfrom azure.identity import DefaultAzureCredential\r\nfrom dotenv import load_dotenv\r\n\r\nclass RoutingAgent:\r\n    \"\"\"Central routing agent powered by Azure AI Foundry.\"\"\"\r\n    \r\n    def __init__(self):\r\n        self.remote_agent_connections = {}\r\n        self.cards = {}\r\n        self.agents_client = AgentsClient(\r\n            endpoint=os.environ[\"AZURE_AI_AGENT_ENDPOINT\"],\r\n            credential=DefaultAzureCredential(),\r\n        )\r\n        self.azure_agent = None\r\n        self.current_thread = None\r\n\r\n    async def initialize(self, remote_agent_addresses: list[str]):\r\n        \"\"\"Initialize with A2A agent discovery.\"\"\"\r\n        # Discover remote agents via A2A protocol\r\n        async with httpx.AsyncClient(timeout=30) as client:\r\n            for address in remote_agent_addresses:\r\n                try:\r\n                    card_resolver = A2ACardResolver(client, address)\r\n                    card = await card_resolver.get_agent_card()\r\n                    \r\n                    from remote_agent_connection import RemoteAgentConnections\r\n                    remote_connection = RemoteAgentConnections(\r\n                        agent_card=card, agent_url=address\r\n                    )\r\n                    self.remote_agent_connections[card.name] = remote_connection\r\n                    self.cards[card.name] = card\r\n                    \r\n                except Exception as e:\r\n                    print(f'Failed to connect to agent at {address}: {e}')\r\n\r\n        # Create Azure AI agent for intelligent routing\r\n        await self._create_azure_agent()\r\n\r\n    async def _create_azure_agent(self):\r\n        \"\"\"Create Azure AI agent with function calling capabilities.\"\"\"\r\n        instructions = self._get_routing_instructions()\r\n        \r\n        # Define function for task delegation\r\n        tools = [{\r\n            \"type\": \"function\",\r\n            \"function\": {\r\n                \"name\": \"send_message\",\r\n                \"description\": \"Delegate task to specialized remote agent\",\r\n                \"parameters\": {\r\n                    \"type\": \"object\",\r\n                    \"properties\": {\r\n                        \"agent_name\": {\"type\": \"string\"},\r\n                        \"task\": {\"type\": \"string\"}\r\n                    },\r\n                    \"required\": [\"agent_name\", \"task\"]\r\n                }\r\n            }\r\n        }]\r\n\r\n        model_name = os.environ.get(\"AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME\", \"gpt-4\")\r\n        self.azure_agent = self.agents_client.create_agent(\r\n            model=model_name,\r\n            name=\"routing-agent\",\r\n            instructions=instructions,\r\n            tools=tools\r\n        )\r\n        \r\n        self.current_thread = self.agents_client.threads.create()\r\n        print(f\"Routing agent initialized: {self.azure_agent.id}\")\r\n\r\n    def _get_routing_instructions(self) -&gt; str:\r\n        \"\"\"Generate context-aware routing instructions.\"\"\"\r\n        agent_info = [\r\n            {'name': card.name, 'description': card.description}\r\n            for card in self.cards.values()\r\n        ]\r\n        \r\n        return f\"\"\"You are an intelligent routing agent for a multi-agent system.\r\n\r\nAvailable Specialist Agents:\r\n{json.dumps(agent_info, indent=2)}<\/code><\/pre>\n<div>\n<div>Routing Guidelines:<\/div>\n<ul>\n<li>Web automation, screenshots, browser tasks \u2192 Playwright Agent<\/li>\n<li>Development tasks, file operations, repository management \u2192 Tool Agent<\/li>\n<li>Always provide comprehensive task context when delegating<\/li>\n<li>Explain to users what specialist is handling their request<\/li>\n<\/ul>\n<\/div>\n<h3 id=\"building-specialized-agents-with-mcp-integration\" class=\"code-line\" dir=\"auto\" data-line=\"274\">Building Specialized Agents with MCP Integration<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"276\">Our remote agents leverage Semantic Kernel&#8217;s MCP integration for extensible capabilities:<\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from semantic_kernel.agents import AzureAIAgent, AzureAIAgentSettings\r\nfrom semantic_kernel.connectors.mcp import MCPStdioPlugin, MCPSsePlugin\r\nfrom azure.identity.aio import DefaultAzureCredential\r\n\r\nclass SemanticKernelMCPAgent:\r\n    \"\"\"Specialized agent with MCP plugin integration.\"\"\"\r\n    \r\n    def __init__(self):\r\n        self.agent = None\r\n        self.client = None\r\n        self.credential = None\r\n        self.plugins = []\r\n\r\n    async def initialize_playwright_agent(self):\r\n        \"\"\"Initialize with Playwright automation via MCP STDIO.\"\"\"\r\n        try:\r\n            self.credential = DefaultAzureCredential()\r\n            self.client = await AzureAIAgent.create_client(\r\n                credential=self.credential\r\n            ).__aenter__()\r\n            \r\n            # Create Playwright MCP plugin\r\n            playwright_plugin = MCPStdioPlugin(\r\n                name=\"Playwright\",\r\n                command=\"npx\",\r\n                args=[\"@playwright\/mcp@latest\"],\r\n            )\r\n            \r\n            await playwright_plugin.__aenter__()\r\n            self.plugins.append(playwright_plugin)\r\n            \r\n            # Create specialized agent\r\n            agent_definition = await self.client.agents.create_agent(\r\n                model=AzureAIAgentSettings().model_deployment_name,\r\n                name=\"PlaywrightAgent\",\r\n                instructions=(\r\n                    \"You are a web automation specialist. Use Playwright to \"\r\n                    \"navigate websites, take screenshots, interact with elements, \"\r\n                    \"and perform browser automation tasks.\"\r\n                ),\r\n            )\r\n\r\n            self.agent = AzureAIAgent(\r\n                client=self.client,\r\n                definition=agent_definition,\r\n                plugins=self.plugins,\r\n            )\r\n            \r\n        except Exception as e:\r\n            await self.cleanup()\r\n            raise\r\n\r\n    async def initialize_tools_agent(self, mcp_url: str):\r\n        \"\"\"Initialize with development tools via MCP SSE.\"\"\"\r\n        try:\r\n            self.credential = DefaultAzureCredential()\r\n            self.client = AzureAIAgent.create_client(credential=self.credential)\r\n            \r\n            # Create development tools MCP plugin\r\n            tools_plugin = MCPSsePlugin(\r\n                name=\"DevTools\",\r\n                url=mcp_url,\r\n            )\r\n            \r\n            await tools_plugin.__aenter__()\r\n            self.plugins.append(tools_plugin)\r\n            \r\n            agent_definition = await self.client.agents.create_agent(\r\n                model=AzureAIAgentSettings().model_deployment_name,\r\n                name=\"DevAssistant\",\r\n                instructions=(\r\n                    \"You are a development assistant. Help with repository \"\r\n                    \"management, file operations, opening projects in VS Code, \"\r\n                    \"and other development tasks.\"\r\n                ),\r\n            )\r\n\r\n            self.agent = AzureAIAgent(\r\n                client=self.client,\r\n                definition=agent_definition,\r\n                plugins=self.plugins,\r\n            )\r\n            \r\n        except Exception as e:\r\n            await self.cleanup()\r\n            raise\r\n\r\n    async def invoke(self, user_input: str) -&gt; dict[str, Any]:\r\n        \"\"\"Process tasks through the specialized agent.\"\"\"\r\n        if not self.agent:\r\n            return {\r\n                'is_task_complete': False,\r\n                'content': 'Agent not initialized.',\r\n            }\r\n\r\n        try:\r\n            responses = []\r\n            async for response in self.agent.invoke(\r\n                messages=user_input,\r\n                thread=self.thread,\r\n            ):\r\n                responses.append(str(response))\r\n                self.thread = response.thread\r\n\r\n            return {\r\n                'is_task_complete': True,\r\n                'content': \"\\n\".join(responses) or \"No response received.\",\r\n            }\r\n        except Exception as e:\r\n            return {\r\n                'is_task_complete': False,\r\n                'content': f'Error: {str(e)}',\r\n            }<\/code><\/pre>\n<h3 id=\"web-interface-with-gradio\" class=\"code-line\" dir=\"auto\" data-line=\"394\">Web Interface with Gradio<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"396\">The system provides a modern chat interface powered by Gradio:<\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">import asyncio\r\nimport gradio as gr\r\nfrom routing_agent import RoutingAgent\r\n\r\nasync def get_response_from_agent(\r\n    message: str, history: list[gr.ChatMessage]\r\n) -&gt; gr.ChatMessage:\r\n    \"\"\"Process user messages through the routing system.\"\"\"\r\n    global ROUTING_AGENT\r\n    \r\n    try:\r\n        response = await ROUTING_AGENT.process_user_message(message)\r\n        return gr.ChatMessage(role=\"assistant\", content=response)\r\n    except Exception as e:\r\n        return gr.ChatMessage(\r\n            role=\"assistant\",\r\n            content=f\"\u274c Error: {str(e)}\"\r\n        )\r\n\r\nasync def main():\r\n    \"\"\"Launch the multi-agent system.\"\"\"\r\n    # Initialize routing agent\r\n    global ROUTING_AGENT\r\n    ROUTING_AGENT = await RoutingAgent.create([\r\n        os.getenv('PLAYWRIGHT_AGENT_URL', 'http:\/\/localhost:10001'),\r\n        os.getenv('TOOL_AGENT_URL', 'http:\/\/localhost:10002'),\r\n    ])\r\n    ROUTING_AGENT.create_agent()\r\n\r\n    # Create Gradio interface\r\n    with gr.Blocks(theme=gr.themes.Ocean()) as demo:\r\n        gr.Markdown(\"# \ud83e\udd16 Azure AI Multi-Agent System\")\r\n        \r\n        gr.ChatInterface(\r\n            get_response_from_agent,\r\n            title=\"Chat with AI Agents\",\r\n            examples=[\r\n                \"Navigate to github.com\/microsoft and take a screenshot\",\r\n                \"Clone repository https:\/\/github.com\/microsoft\/semantic-kernel\",\r\n                \"Open the cloned project in VS Code\",\r\n            ]\r\n        )\r\n\r\n    demo.launch(server_name=\"0.0.0.0\", server_port=8083)<\/code><\/pre>\n<h3 id=\"deployment-and-operations\" class=\"code-line\" dir=\"auto\" data-line=\"445\">Deployment and Operations<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"447\"><strong>Local Development:<\/strong><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># Start MCP server (Azure Functions)\r\ncd mcp_sse_server\/MCPAzureFunc\r\nfunc start\r\n\r\n# Start remote agents in separate terminals\r\ncd remote_agents\/playwright_agent &amp;&amp; uv run .\r\ncd remote_agents\/tool_agent &amp;&amp; uv run .\r\n\r\n# Start the host agent with web interface\r\ncd host_agent &amp;&amp; uv run .<\/code><\/pre>\n<p class=\"code-line\" dir=\"auto\" data-line=\"461\"><strong>Production Considerations:<\/strong><\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"462\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"462\">Deploy each agent as a separate microservice using Azure Container Apps<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"463\">Use Azure Service Bus for robust agent discovery and communication<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"464\">Implement comprehensive logging with Azure Application Insights<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"465\">Configure proper authentication and network security<\/li>\n<\/ul>\n<h3 id=\"real-world-usage-examples\" class=\"code-line\" dir=\"auto\" data-line=\"467\">Real-World Usage Examples<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"469\">Based on our implementation, here are practical examples of how the multi-agent system handles different types of requests:<\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"471\"><strong>Example 1: Web Automation Task<\/strong><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">User: \"Navigate to github.com\/microsoft and take a screenshot\"\r\n\r\nFlow:\r\n1. Host Agent (Azure AI) analyzes the request\r\n2. Identifies this as a web automation task  \r\n3. Delegates to Playwright Agent via A2A protocol\r\n4. Playwright Agent uses MCP STDIO to execute browser automation\r\n5. Returns screenshot and navigation details to user<\/code><\/pre>\n<p dir=\"auto\" data-line=\"471\"><strong>Example 2: Development Workflow<\/strong><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">User: \"Clone https:\/\/github.com\/microsoft\/semantic-kernel and open it in VS Code\"\r\n\r\nFlow:\r\n1. Host Agent recognizes repository management + IDE operation\r\n2. Delegates to Tool Agent via A2A protocol  \r\n3. Tool Agent uses MCP SSE connection to Azure Functions\r\n4. Executes git clone and VS Code launch commands\r\n5. Reports success status back to user<\/code><\/pre>\n<p class=\"code-line\" dir=\"auto\" data-line=\"495\"><em><strong>Note<\/strong><\/em>\u00a0You can click this\u00a0<a href=\"https:\/\/github.com\/a2aproject\/a2a-samples\/blob\/main\/samples\/python\/agents\/azureaifoundry_sdk\/multi_agent\/README.md\" data-href=\"https:\/\/github.com\/a2aproject\/a2a-samples\/blob\/main\/samples\/python\/agents\/azureaifoundry_sdk\/multi_agent\/README.md\">link<\/a>\u00a0and get this sample<\/p>\n<h2 id=\"future-considerations-and-roadmap\" class=\"code-line\" dir=\"auto\" data-line=\"498\">Future Considerations and Roadmap<\/h2>\n<p class=\"code-line\" dir=\"auto\" data-line=\"500\">As both Semantic Kernel and the A2A protocol continue to evolve, several developments are worth monitoring:<\/p>\n<h3 id=\"emerging-features\" class=\"code-line\" dir=\"auto\" data-line=\"502\">Emerging Features<\/h3>\n<ol class=\"code-line\" dir=\"auto\" data-line=\"504\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"504\"><strong>Enhanced Streaming Support<\/strong>: Better support for real-time streaming interactions between agents<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"505\"><strong>Multimodal Communication<\/strong>: Expanded support for audio, video, and other rich media types<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"506\"><strong>Dynamic UX Negotiation<\/strong>: Agents that can negotiate and adapt their interaction modalities mid-conversation<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"507\"><strong>Improved Client-Initiated Methods<\/strong>: Better support for scenarios where clients need to initiate actions beyond basic task management<\/li>\n<\/ol>\n<h3 id=\"integration-opportunities\" class=\"code-line\" dir=\"auto\" data-line=\"509\">Integration Opportunities<\/h3>\n<ol class=\"code-line\" dir=\"auto\" data-line=\"511\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"511\"><strong>Azure AI Foundry Integration<\/strong>: Native A2A support within Azure&#8217;s AI platform<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"512\"><strong>Copilot Studio Compatibility<\/strong>: Seamless integration with Microsoft&#8217;s low-code agent building platform<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"513\"><strong>Enterprise Service Integration<\/strong>: Better integration with enterprise identity and governance systems<\/li>\n<\/ol>\n<h3 id=\"community-and-ecosystem\" class=\"code-line\" dir=\"auto\" data-line=\"515\">Community and Ecosystem<\/h3>\n<p class=\"code-line\" dir=\"auto\" data-line=\"517\">The A2A protocol benefits from strong industry backing, with over 50 technology partners contributing to its development. As the ecosystem matures, expect:<\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"519\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"519\">More comprehensive tooling and SDK support<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"520\">Standardized patterns for common multi-agent scenarios<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"521\">Enhanced interoperability testing and certification programs<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"522\">Growing library of reusable A2A-compliant agents<\/li>\n<\/ul>\n<h2 id=\"conclusion\" class=\"code-line\" dir=\"auto\" data-line=\"524\">Conclusion<\/h2>\n<p class=\"code-line\" dir=\"auto\" data-line=\"526\">The combination of Semantic Kernel&#8217;s powerful orchestration capabilities with Google&#8217;s A2A protocol represents a significant step forward in building truly interoperable multi-agent systems. This integration enables developers to:<\/p>\n<ul class=\"code-line\" dir=\"auto\" data-line=\"528\">\n<li class=\"code-line\" dir=\"auto\" data-line=\"528\"><strong>Break down silos<\/strong>\u00a0between different AI frameworks and platforms<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"529\"><strong>Leverage existing investments<\/strong>\u00a0in Semantic Kernel while gaining cross-platform compatibility<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"530\"><strong>Build scalable, enterprise-grade<\/strong>\u00a0multi-agent solutions with proper security and observability<\/li>\n<li class=\"code-line\" dir=\"auto\" data-line=\"531\"><strong>Future-proof applications<\/strong>\u00a0by adopting open standards for agent communication<\/li>\n<\/ul>\n<p class=\"code-line\" dir=\"auto\" data-line=\"533\">As the agentic AI landscape continues to evolve rapidly, the ability to create flexible, interoperable systems becomes increasingly valuable. By combining the orchestration power of Semantic Kernel with the standardized communication capabilities of A2A, developers can build sophisticated multi-agent applications that are both powerful and portable.<\/p>\n<p class=\"code-line\" dir=\"auto\" data-line=\"535\">The journey toward truly collaborative AI systems is just beginning, and the tools and patterns demonstrated in this article provide a solid foundation for building the next generation of intelligent applications. Whether you&#8217;re enhancing existing Semantic Kernel applications or building new multi-agent systems from scratch, the integration of these technologies offers a path toward more capable, flexible, and interoperable AI solutions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the rapidly evolving landscape of AI application development, the ability to orchestrate multiple intelligent agents has become crucial for building sophisticated, enterprise-grade solutions. While individual AI agents excel at specific tasks, complex business scenarios often require coordination between specialized agents running on different platforms, frameworks, or even across organizational boundaries. This is where the [&hellip;]<\/p>\n","protected":false},"author":106050,"featured_media":4983,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[142,1],"tags":[],"class_list":["post-4967","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-a2a","category-semantic-kernel"],"acf":[],"blog_post_summary":"<p>In the rapidly evolving landscape of AI application development, the ability to orchestrate multiple intelligent agents has become crucial for building sophisticated, enterprise-grade solutions. While individual AI agents excel at specific tasks, complex business scenarios often require coordination between specialized agents running on different platforms, frameworks, or even across organizational boundaries. This is where the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/4967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/users\/106050"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/comments?post=4967"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/4967\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media\/4983"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media?parent=4967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/categories?post=4967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/tags?post=4967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}