Skip to content

Conversation

lilyydu
Copy link
Collaborator

@lilyydu lilyydu commented Oct 16, 2025

  • completed a2a client plugin
  • completed a2a server plugin
  • completed a2a server + client sample test

NOTE #1: Due to the event looping implementation by the external a2a SDK, they may raise a CancelledError when in debug mode. This is because EventConsumer.consume_all will attempt to dequeue the event, with a 0.5 second timeout.
Our response however takes more than 0.5 seconds to generate.
Hence, the task is cancelled by wait_for, which causes CancelledError.
This is raised by the coroutine DefaultRequestHandler, but consume_all recognizes it as TimeoutError and will continue to reloop and try again. I don't think there is any way to mitigate this as our response takes ~ 1 second to generate.

NOTE #2: Improving the event type hinting will be a separate WI, for now I am using a specific key. This feels like a larger ticket b/c I think we should improve our typing hints for all our events in general. I noticed we can do the following (string or any type versus ErrorEvent) & it doesn't complain-

@app.event("error")
async def handle_error(event: str) -> None:

NOTE #3: Will follow with docs soon after.

Sample example:
image

@Copilot Copilot AI review requested due to automatic review settings October 16, 2025 17:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive support for Agent-to-Agent (A2A) protocol communication in the Microsoft Teams AI Library, enabling agents to communicate with each other using the A2A SDK. The implementation includes both server and client capabilities with a complete test application demonstrating bidirectional agent communication.

Key Changes:

  • Implemented A2A server plugin (A2APlugin) for exposing agents via A2A protocol
  • Implemented A2A client plugin (A2AClientPlugin) for consuming A2A agents
  • Added comprehensive test application demonstrating both server and client functionality
  • Modified event registration to log warnings instead of raising errors for unregistered event types

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/a2a-test/src/main.py Complete test application demonstrating A2A server and client integration with weather agent example
tests/a2a-test/pyproject.toml Project configuration for a2a test application with required dependencies
tests/a2a-test/README.md Documentation explaining the test application usage with example conversations
packages/apps/src/microsoft/teams/apps/app.py Changed unregistered event type handling from error to info log
packages/a2aprotocol/src/microsoft/teams/a2a/server/plugin.py A2A server plugin implementation with middleware support and FastAPI integration
packages/a2aprotocol/src/microsoft/teams/a2a/server/logging_middleware.py Logging middleware for A2A server requests
packages/a2aprotocol/src/microsoft/teams/a2a/server/custom_agent_executor.py Custom agent executor implementing A2A message handling with event emission
packages/a2aprotocol/src/microsoft/teams/a2a/server/a2a_plugin_options.py Configuration options for A2A server plugin
packages/a2aprotocol/src/microsoft/teams/a2a/server/init.py Server module exports
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/types.py Type definitions for A2A client plugin including metadata builders and configuration
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/plugin.py A2A client plugin implementation with agent card fetching and function registration
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/agent_config.py Agent configuration model for storing client connection details
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/agent_client_info.py Model combining agent config with client instance and card
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/init.py Client module exports
packages/a2aprotocol/src/microsoft/teams/a2a/init.py Root module exports combining server and client functionality
packages/a2aprotocol/pyproject.toml Updated package name and added AI/apps dependencies
Comments suppressed due to low confidence (1)

packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/types.py:18

  • Missing docstring for the FunctionMetadata class. As this is a public API type, it should include a class docstring explaining its purpose in the A2A context.
class FunctionMetadata(BaseModel):
    name: str
    description: str

Copy link
Collaborator

@heyitsaamir heyitsaamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice this is looking solid!

@lilyydu lilyydu merged commit c04d747 into main Oct 21, 2025
7 of 10 checks passed
@lilyydu lilyydu deleted the lilyydu/a2a branch October 21, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants