-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add a2a server and client plugins and samples #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
packages/a2aprotocol/src/microsoft/teams/a2a/server/a2a_plugin_options.py
Outdated
Show resolved
Hide resolved
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/plugin.py
Outdated
Show resolved
Hide resolved
packages/a2aprotocol/src/microsoft/teams/a2a/chat_prompt/plugin.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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!
NOTE #1: Due to the event looping implementation by the external a2a SDK, they may raise a
CancelledError
when in debug mode. This is becauseEventConsumer.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 causesCancelledError
.This is raised by the coroutine
DefaultRequestHandler
, butconsume_all
recognizes it asTimeoutError
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-NOTE #3: Will follow with docs soon after.
Sample example:
