Microsoft Dev Blogs

Integrating Semantic Kernel Python with Google’s A2A Protocol

thumbnail

Table of Contents

  1. Our Contribution to the A2A Ecosystem
    • Exploring Azure AI Foundry and Google's A2A Protocol
  2. CurrencyExchangeAgent
    • Specialized agent for currency-related tasks
  3. How Integration Works
    • Task Routing and Delegation
    • Agent Discovery
  4. Example Scenario
    • User request for a budget-friendly trip plan with currency conversion
  5. Prerequisites
    • Python 3.10 or higher
    • Package manager
    • OpenAI credentials
    • Optional: Frankfurter API key
  6. Setup & Running
    • Navigating to the Semantic Kernel sample
    • Creating a .env file
    • Setting up the environment
    • Running the Semantic Kernel Agent
    • Running the A2A Client
  7. What's Next
    • Development of additional integration samples
  8. Share Your Feedback
    • Exploring the sample in the A2A repository

Our Contribution to the A2A Ecosystem

We have integrated Azure AI Foundry's Semantic Kernel with Google's A2A Protocol, enabling communication among agents over plain HTTP using a lightweight JSON-RPC protocol. Our initial contribution to the A2A ecosystem addresses the absence of a packaged A2A library, facilitating easier integration for developers. By leveraging existing sample code, Semantic Kernel agents can efficiently integrate into the A2A ecosystem, ensuring optimal task delegation and response handling.

CurrencyExchangeAgent

The CurrencyExchangeAgent is a specialized agent within the Semantic Kernel that manages currency-related tasks, such as currency conversion and exchange rate calculations.

How Integration Works

  • Task Routing and Delegation: The TravelManager routes tasks dynamically to specialized agents configured as plugins within the system, ensuring efficient handling based on context.
  • Agent Discovery: Agents advertise their capabilities through structured "Agent Cards," allowing client agents to identify and select the most suitable agent for a given task, promoting seamless communication through the A2A protocol.

Example Scenario

In a scenario where a user requests a budget-friendly trip plan with currency conversion, the TravelManager processes the request by delegating currency-related tasks to the CurrencyExchangeAgent. The agent fetches currency rates from external sources, such as Frankfurter API, to provide accurate conversion rates.

Prerequisites

To run the integration, ensure you have:

  • Python 3.10 or higher installed
  • A package manager for Python
  • Valid OpenAI credentials (as per Semantic Kernel documentation)
  • Optional: Frankfurter API key for accessing currency exchange rates

Setup & Running

  1. Navigate to the Semantic Kernel sample in the A2A repository.
  2. Create a .env file with necessary configurations.
  3. Set up the environment using the instructed Python version.
  4. Run the Semantic Kernel Agent to initialize the agent.
  5. Launch the A2A Client in a separate terminal to interact with the agent.

Upon successful execution, you will see the Semantic Kernel Travel Agent Manager discovered, allowing for seamless query interactions using the A2A protocol.

What's Next

We are actively developing additional integration samples, including connections with Azure AI Foundry through Semantic Kernel's AzureAIAgent. Stay tuned for updates on new features and integrations.

Share Your Feedback

Explore the integration sample in the A2A repository and share your insights and feedback with us as we continue to evolve and enhance the A2A ecosystem. Your input is valuable to us in shaping the future of agent communication and interoperability.