Google’s Agent-to-Agent (A2A) protocol is designed to enable seamless interoperability among diverse AI agents. Microsoft’s Semantic Kernel (SK), an open-source platform for orchestrating intelligent agent interactions, is now being integrated into the A2A ecosystem. In this blog, we demonstrate how Semantic Kernel agents can easily function as an A2A Server, efficiently routing agent calls to specialized services.
You can read more about the A2A protocol in Google’s technical documentation.
Our Contribution to the A2A Ecosystem
Our initial contribution 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’re 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.
Key Components of the Integration
SemanticKernelTravelManager
The SemanticKernelTravelManager 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 CurrencyExchangeAgent, whereas activity or itinerary-related requests are forwarded to the ActivityPlannerAgent. This ensures optimal delegation and efficient response handling.
CurrencyExchangeAgent
This specialized agent handles currency-related tasks. It integrates external API tools, such as the Frankfurter API, to provide real-time currency exchange rates. By leveraging these data sources, the agent enables accurate budgeting and financial planning.
ActivityPlannerAgent
The ActivityPlannerAgent curates personalized travel experiences by offering tailored itinerary suggestions, activities, and event bookings based on user preferences and budgets.
How Integration Works
- Task Routing and Delegation: 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.
- Agent Discovery: Agents advertise their capabilities through a structured “Agent Card,” 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.
- Conversational Memory: 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.
Example Scenario
Imagine a user wants a budget-friendly trip plan with currency conversion:
- User submits a request to the TravelManager.
- The TravelManager detects currency needs and invokes CurrencyExchangeAgent.
- CurrencyExchangeAgent fetches rates from Frankfurter.
- ActivityPlannerAgent suggests budget-friendly options.
- The TravelManager compiles and returns a complete trip plan.
Getting Started
Ensure you have the latest version of the A2A repository cloned locally to run this demo successfully.
Prerequisites
- Python 3.10 or higher
uv
package manager (see uv documentation on how to install)- Valid OpenAI credentials (see SK documentation)
- Optional: Frankfurter API key, not required to hit the free endpoint
Setup & Running
- Navigate to the Semantic Kernel sample in the A2A sample directory:
cd samples/python/agents/semantickernel
- Create a .env file:
OPENAI_API_KEY="your_api_key_here" OPENAI_CHAT_MODEL_ID="your-model-id"
- Set up the environment (pin to your desired/installed Python version):
uv python pin 3.12 uv venv source .venv/bin/activate
- Run the Semantic Kernel Agent:
# Default configuration uv run . # Otherwise run with a custom host and/or port uv run . --host 0.0.0.0 --port 8080
- Run the A2A Client (in separate terminal):
cd samples/python uv run hosts/cli
After executing uv run .
in the samples/python/agents/semantickernel
directory, you’ll observe uv
installing the necessary packages. Once complete, you’ll see output similar to the following, indicating the server is up and running:
When you run uv run hosts/cli
in the samples/python
directory, you’ll notice an Agent Card displayed, confirming that the Semantic Kernel Travel Agent Manager has been successfully discovered and is ready for interaction:
You can now send queries directly to the agent. For example: “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?” Submitting this request initiates processing on the Semantic Kernel A2A Server, where the Travel Manager dynamically delegates tasks to its configured plugin agents. You’ll see streaming event messages in your console reflecting different stages of request handling—these streaming events can also contain partial text responses in a production-ready scenario. Upon completion, you’ll receive a structured JSON response similar to the following:
What’s Next
We’re actively developing additional integration samples, such as connecting with Azure AI Foundry via Semantic Kernel’s AzureAIAgent. Additionally, we’re planning to contribute an A2A sample directly to the Semantic Kernel repository. Stay tuned for future updates!
Share Your Feedback
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.
Thank you for reading.
0 comments
Be the first to start the discussion.