{"id":247,"date":"2025-04-17T06:30:00","date_gmt":"2025-04-17T13:30:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/foundry\/?p=247"},"modified":"2025-08-13T16:24:21","modified_gmt":"2025-08-13T23:24:21","slug":"semantic-kernel-a2a-integration","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/foundry\/semantic-kernel-a2a-integration\/","title":{"rendered":"Integrating Semantic Kernel Python with Google&#8217;s A2A Protocol"},"content":{"rendered":"<p>Google\u2019s Agent\u2011to\u2011Agent (A2A) protocol offers a common standard for cross\u2011cloud AI collaboration. Azure AI Foundry&#8217;s Semantic Kernel now speaks A2A: <span data-teams=\"true\">a lightweight JSON\u2011RPC protocol that lets agents across clouds swap context, not code or credentials, over plain HTTP. Drop it into your Azure AI Foundry stack for instant, secure, async interoperability with any A2A\u2011compliant agent, regardless of modality.<\/span><\/p>\n<p>Discover Azure AI Foundry in its official <a href=\"https:\/\/azure.microsoft.com\/en-us\/products\/ai-foundry\">documentation<\/a>, and explore Google\u2019s technical <a href=\"https:\/\/google.github.io\/A2A\/#\/documentation\">docs<\/a> for a deep dive into the A2A protocol<\/p>\n<h2><strong>Our Contribution to the A2A Ecosystem<\/strong><\/h2>\n<p>Our <a href=\"https:\/\/github.com\/a2aproject\/a2a-samples\/tree\/main\/samples\/python\/agents\/semantickernel\">initial contribution<\/a> to the A2A repository addresses the current absence of a packaged A2A library, making it challenging for developers to quickly build integrations. Since the A2A protocol is still emerging, we\u2019re leveraging existing sample code directly from the A2A repository to demonstrate how Semantic Kernel agents can effectively integrate into this ecosystem. Our goal is to provide a clear integration path, enabling customers to easily adopt Semantic Kernel within their A2A projects.<\/p>\n<h2><strong>Key Components of the Integration<\/strong><\/h2>\n<h4><strong>SemanticKernelTravelManager<\/strong><\/h4>\n<p>The <strong>SemanticKernelTravelManager<\/strong> serves as the central coordinator, receiving and analyzing incoming requests. It intelligently routes these requests to specialized agents based on the context. For example, currency-related queries are sent directly to the <strong>CurrencyExchangeAgent<\/strong>, whereas activity or itinerary-related requests are forwarded to the <strong>ActivityPlannerAgent<\/strong>. This ensures optimal delegation and efficient response handling.<\/p>\n<h4><strong>CurrencyExchangeAgent<\/strong><\/h4>\n<p>This specialized agent handles currency-related tasks. It integrates external API tools, such as the <a href=\"https:\/\/www.frankfurter.app\/\">Frankfurter API<\/a>, to provide real-time currency exchange rates. By leveraging these data sources, the agent enables accurate budgeting and financial planning.<\/p>\n<h4><strong>ActivityPlannerAgent<\/strong><\/h4>\n<p>The <strong>ActivityPlannerAgent<\/strong> curates personalized travel experiences by offering tailored itinerary suggestions, activities, and event bookings based on user preferences and budgets.<\/p>\n<h3><strong>How Integration Works<\/strong><\/h3>\n<ul>\n<li><strong>Task Routing and Delegation<\/strong>: The TravelManager dynamically routes tasks to specialized agents, which are configured as plugins within the TravelManager itself. Leveraging context awareness and automatic function calling, the underlying model intelligently determines the most suitable agent to handle each request.<\/li>\n<li><strong>Agent Discovery<\/strong>: Agents advertise their capabilities through a structured &#8220;Agent Card,&#8221; enabling client agents to efficiently identify and select the most suitable agent for a given task, facilitating seamless communication through the A2A protocol. This example advertises one Semantic Kernel agent.<\/li>\n<li><strong>Conversational Memory<\/strong>: Semantic Kernel maintains context using its chat history across multi-turn interactions, providing a seamless user experience. In this sample the history is ephemeral and not persisted.<\/li>\n<\/ul>\n<h2><strong>Example Scenario<\/strong><\/h2>\n<p>Imagine a user wants a budget-friendly trip plan with currency conversion:<\/p>\n<ol>\n<li>User submits a request to the <strong>TravelManager<\/strong>.<\/li>\n<li>The TravelManager detects currency needs and invokes <strong>CurrencyExchangeAgent<\/strong>.<\/li>\n<li><strong>CurrencyExchangeAgent<\/strong> fetches rates from Frankfurter.<\/li>\n<li><strong>ActivityPlannerAgent<\/strong> suggests budget-friendly options.<\/li>\n<li>The TravelManager compiles and returns a complete trip plan.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-249\" src=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a-1024x531.png\" alt=\"Semantic Kernel + A2A Integration Mermaid Diagram\" width=\"1024\" height=\"531\" srcset=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a-1024x531.png 1024w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a-300x155.png 300w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a-768x398.png 768w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a-1536x796.png 1536w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/1_mermaid_a2a-2048x1061.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2><strong>Getting Started<\/strong><\/h2>\n<p>Ensure you have the latest version of the <a href=\"https:\/\/github.com\/google\/A2A\">A2A repository<\/a> cloned locally to run this demo successfully.<\/p>\n<h3><strong>Prerequisites<\/strong><\/h3>\n<ul>\n<li>Python 3.10 or higher<\/li>\n<li><code>uv<\/code> package manager (see <a href=\"https:\/\/docs.astral.sh\/uv\/getting-started\/installation\/\">uv documentation<\/a> on how to install)<\/li>\n<li>Valid OpenAI credentials (see <a href=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/concepts\/ai-services\/chat-completion\/?tabs=python-AzureOpenAI\">SK documentation<\/a>)<\/li>\n<li>Optional: Frankfurter API key (not required for free endpoint)<\/li>\n<\/ul>\n<h3><strong>Setup &amp; Running<\/strong><\/h3>\n<ol>\n<li><strong>Navigate to the Semantic Kernel sample in the A2A sample directory:<\/strong>\n<pre><code class=\"language-sh\">cd samples\/python\/agents\/semantickernel<\/code><\/pre>\n<\/li>\n<li><strong>Create a .env file:<\/strong>\n<pre><code class=\"language-sh\">OPENAI_API_KEY=\"your_api_key_here\"\r\nOPENAI_CHAT_MODEL_ID=\"your-model-id\"<\/code><\/pre>\n<\/li>\n<li><strong>Set up the environment (pin to your desired\/installed Python version):<\/strong>\n<pre><code class=\"language-sh\">uv python pin 3.12\r\nuv venv\r\nsource .venv\/bin\/activate<\/code><\/pre>\n<\/li>\n<li><strong>Run the Semantic Kernel Agent:<\/strong>\n<pre><code class=\"language-sh\"># Default configuration\r\nuv run .\r\n\r\n# Otherwise run with a custom host and\/or port\r\nuv run . --host 0.0.0.0 --port 8080<\/code><\/pre>\n<\/li>\n<li><strong>Run the A2A Client (in a separate terminal):<\/strong>\n<pre><code class=\"language-sh\">cd samples\/python\r\nuv run hosts\/cli --agent http:\/\/localhost:10020<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>After executing <code>uv run .<\/code> in the <code>samples\/python\/agents\/semantickernel<\/code> directory, you&#8217;ll observe <code>uv<\/code> installing the necessary packages. Once complete, you&#8217;ll see output similar to the following, indicating the server is up and running:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_server_new.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-256\" src=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_server_new.png\" alt=\"Image sk a2a server new\" width=\"770\" height=\"174\" srcset=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_server_new.png 770w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_server_new-300x68.png 300w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_server_new-768x174.png 768w\" sizes=\"(max-width: 770px) 100vw, 770px\" \/><\/a><\/p>\n<p>When you run <code>uv run hosts\/cli<\/code> in the <code>samples\/python<\/code> directory, you&#8217;ll notice an Agent Card displayed, confirming that the Semantic Kernel Travel Agent Manager has been successfully discovered and is ready for interaction:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_client_new.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-257\" src=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_client_new-1024x261.png\" alt=\"Image sk a2a client new\" width=\"1024\" height=\"261\" srcset=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_client_new-1024x261.png 1024w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_client_new-300x76.png 300w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_client_new-768x196.png 768w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/sk_a2a_client_new.png 1028w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>You can now send queries directly to the agent. For example:<\/p>\n<blockquote><p>I am traveling to Seoul, South Korea for 2 days. I have a budget of $100 USD a day. How much is that in South Korean Won? What sort of things can I do and eat?<\/p><\/blockquote>\n<p>Submitting this request initiates processing on the Semantic Kernel A2A Server, where the Travel Manager dynamically delegates tasks to its configured plugin agents. You&#8217;ll see streaming event messages in your console reflecting different stages of request handling\u2014these streaming events can also contain partial text responses in a production-ready scenario. Upon completion, you&#8217;ll receive a structured JSON response similar to the following:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-252\" src=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result-1024x413.png\" alt=\"SK + A2A Agent Result\" width=\"1024\" height=\"413\" srcset=\"https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result-1024x413.png 1024w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result-300x121.png 300w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result-768x310.png 768w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result-1536x620.png 1536w, https:\/\/devblogs.microsoft.com\/foundry\/wp-content\/uploads\/sites\/89\/2025\/04\/4_sk_a2a_result.png 1762w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2><strong>What&#8217;s Next<\/strong><\/h2>\n<p>We&#8217;re actively developing additional integration samples, such as connecting with Azure AI Foundry via Semantic Kernel&#8217;s <a href=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/frameworks\/agent\/azure-ai-agent?pivots=programming-language-python\">AzureAIAgent<\/a>. Additionally, we&#8217;re planning to contribute an A2A sample directly to the Semantic Kernel repository. Stay tuned for future updates!<\/p>\n<h2>Share Your Feedback<\/h2>\n<p>Explore this sample in the A2A repository. As the A2A protocol continues to evolve, your insights and feedback are valuable to us. Let us know how you envision using the protocol for enhanced agent discovery, advanced multi-agent task coordination, and other innovative scenarios.<\/p>\n<p>To learn more about the Semantic Kernel Agent Framework and explore the different types of agents available, visit the <a href=\"https:\/\/learn.microsoft.com\/en-us\/semantic-kernel\/frameworks\/agent\/?pivots=programming-language-python\">Semantic Kernel Learn Site<\/a>.<\/p>\n<p>Thank you for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introducing the integration of Microsoft&#8217;s Semantic Kernel with Google&#8217;s A2A protocol, enabling Semantic Kernel agents to seamlessly exchange context, instructions, and data with other agents to collaboratively accomplish tasks.<\/p>\n","protected":false},"author":150043,"featured_media":253,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[24,25,16,26,23],"class_list":["post-247","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-foundry","tag-a2a","tag-agents","tag-ai-applications","tag-protocol","tag-semantic-kernel"],"acf":[],"blog_post_summary":"<p>Introducing the integration of Microsoft&#8217;s Semantic Kernel with Google&#8217;s A2A protocol, enabling Semantic Kernel agents to seamlessly exchange context, instructions, and data with other agents to collaboratively accomplish tasks.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/posts\/247","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\/150043"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/comments?post=247"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/posts\/247\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/media\/253"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/media?parent=247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/categories?post=247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/foundry\/wp-json\/wp\/v2\/tags?post=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}