Python: feat: Add Agent Framework to A2A bridge support#2403
Python: feat: Add Agent Framework to A2A bridge support#2403moonbox3 merged 53 commits intomicrosoft:mainfrom
Conversation
- Implement A2A event adapter for converting agent messages to A2A protocol - Add A2A execution context for managing agent execution state - Implement A2A executor for running agents in A2A environment - Add comprehensive unit tests for event adapter, execution context, and executor - Update agent framework core A2A module exports and type stubs - Integrate thread management utilities for async execution - Add getting started sample for A2A agent framework integration - Update dependencies in uv.lock This integration enables agent framework agents to communicate and execute within the A2A (Agent to Agent) infrastructure.
…rage in A2A executor tests
- Reordered imports in various files for consistency and clarity. - Updated `__all__` definitions to maintain a consistent order across modules. - Simplified method signatures by removing unnecessary line breaks. - Enhanced readability by adjusting formatting in several sections. - Removed redundant comments and example scenarios in the execution context. - Improved handling of agent messages in the event adapter. - Added type hints for better clarity and type checking. - Cleaned up test cases for better organization and readability.
- Deleted the test file for A2aExecutionContext as it is no longer needed. - Updated A2aExecutor tests to remove dependencies on A2aExecutionContext and adjusted method calls accordingly. - Modified event adapter tests to use ChatMessage instead of AgentRunResponseUpdate. - Removed A2aExecutionContext from imports in agent_framework.a2a module and updated type hints accordingly.
eavanvalkenburg
left a comment
There was a problem hiding this comment.
I like the idea behind this, but there are some major issues with the implementation, especially the addition of the AgentThreadStore, please discuss that further with us.
- Updated test cases to use A2AExecutor instead of A2aExecutor for consistency. - Removed mock_event_adapter fixture and related tests as A2aEventAdapter is deprecated. - Consolidated event handling tests into TestA2AExecutorEventAdapter. - Adjusted imports in various files to reflect the removal of deprecated components. - Ensured all references to A2aExecutor are updated to A2AExecutor across the codebase.
|
Hi @eavanvalkenburg thanks for the review. I have further simplified the code for this feature and have addressed most of you review comments. Regarding your major concern around Do let me know if any other changes are required. |
|
I have successfully addressed all mentioned review comments. |
|
@Shubham-Kumar-2000 we have redone the threads, now called sessions, and the context providers,please update if you can! |
Sure @eavanvalkenburg give me sometime let me go through the changes. |
…nto agent_framework_to_a2a
- Consolidated mock agent fixtures in test_a2a_executor.py to simplify agent mocking. - Removed redundant tests related to thread storage and agent types, focusing on A2AExecutor's core functionality. - Updated test assertions to reflect changes in message handling with new Message and Content classes. - Enhanced integration tests to ensure compatibility with the new agent framework structure. - Added A2AExecutor to the module exports in __init__.py and __init__.pyi for better accessibility.
…d_dotenv call in agent_framework_to_a2a.py
…and fix agent creation method
…umar-2000/agent-framework into agent_framework_to_a2a
|
Hi @eavanvalkenburg I have addressed all new review comments. |
|
@Shubham-Kumar-2000 one of the checks fail, please run the pre-commit jobs, it looks like a ruff issue |
|
Hi @eavanvalkenburg I have fixed the lint issue and also merged with master. |
There was a problem hiding this comment.
Pull request overview
This PR adds Python “hosting-side” support to expose Agent Framework agents as A2A-compliant servers, complementing the existing A2A client integration.
Changes:
- Introduces
A2AExecutorto bridgeSupportsAgentRunagents into the A2A server execution model (including streaming support). - Updates Agent Framework
agent_framework.a2aexports/type stubs and theagent-framework-a2apackage exports/docs. - Adds a new hosting sample and a comprehensive unit test suite for the executor.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/04-hosting/a2a/agent_framework_to_a2a.py | New sample that hosts an Agent Framework agent via an A2A Starlette app using A2AExecutor. |
| python/samples/04-hosting/a2a/README.md | Documents the new sample and how to run it. |
| python/packages/core/agent_framework/a2a/init.pyi | Updates typing exports to include A2AExecutor. |
| python/packages/core/agent_framework/a2a/init.py | Extends lazy re-exports to include A2AExecutor. |
| python/packages/a2a/agent_framework_a2a/_a2a_executor.py | Implements the new A2AExecutor bridging Agent Framework responses into A2A task events. |
| python/packages/a2a/agent_framework_a2a/init.py | Exports A2AExecutor from the agent_framework_a2a package. |
| python/packages/a2a/tests/test_a2a_executor.py | Adds unit tests covering executor initialization, execution paths, streaming updates, and content conversions. |
| python/packages/a2a/README.md | Adds documentation for A2AExecutor hosting usage alongside A2AAgent. |
| python/packages/a2a/AGENTS.md | Updates package docs to describe both A2AAgent (client) and A2AExecutor (hosting/bridge). |
…ixed review comments
|
Hi @eavanvalkenburg I have made changes regarding the review comments from |
…ata from data URIs and update references
|
Hi @eavanvalkenburg I have fixed the failing checks. But it required to move one function used in both |
|
Please let me know if any anything else is required from my end |
|
Hi @eavanvalkenburg |
Previous commit incorrectly renamed the [1.1.1] header to [1.2.0], which wiped the historical 1.1.1 entries and wrongly attributed them to 1.2.0. This restores [1.1.1] to its origin/main content and adds a new [1.2.0] section above containing only the commits in python-1.1.1..HEAD: - microsoft#4238 functional workflow API - microsoft#5142 GitHub Copilot OpenTelemetry - microsoft#2403 A2A bridge support - microsoft#5070 oauth_consent_request events in Foundry clients - microsoft#5447 FoundryAgent hosted agent sessions - microsoft#5459 hosting server dependency upgrade + types - microsoft#5389 AG-UI reasoning/multimodal parsing fix - microsoft#5440 stop [TOOLBOXES] warning spam - microsoft#5455 user agent prefix fix Also corrects the [1.2.0] compare base to python-1.1.1 (not 1.1.0) and adds the missing [1.1.1] reference link.
* Bump Python package versions for 1.2.0 release Released tier bumps 1.1.1 -> 1.2.0 (core, openai, foundry, root) to reflect additive public APIs landed since 1.1.0: functional workflow API (#4238) and FunctionTool SKIP_PARSING sentinel (#5424). All beta packages stamped 1.0.0b260424, alpha packages 1.0.0a260424. All 26 non-core agent-framework-core floors raised to >=1.2.0,<2. CHANGELOG consolidates the never-tagged 1.1.1 entries with the post-merge additions into [1.2.0]. * Update CHANGELOG footer links for 1.2.0 Advance [Unreleased] comparison base from python-1.1.0 to python-1.2.0 and add a [1.2.0] reference link comparing python-1.1.0...python-1.2.0 so the heading links resolve correctly. * Fix CHANGELOG: restore [1.1.1] section and add proper [1.2.0] Previous commit incorrectly renamed the [1.1.1] header to [1.2.0], which wiped the historical 1.1.1 entries and wrongly attributed them to 1.2.0. This restores [1.1.1] to its origin/main content and adds a new [1.2.0] section above containing only the commits in python-1.1.1..HEAD: - #4238 functional workflow API - #5142 GitHub Copilot OpenTelemetry - #2403 A2A bridge support - #5070 oauth_consent_request events in Foundry clients - #5447 FoundryAgent hosted agent sessions - #5459 hosting server dependency upgrade + types - #5389 AG-UI reasoning/multimodal parsing fix - #5440 stop [TOOLBOXES] warning spam - #5455 user agent prefix fix Also corrects the [1.2.0] compare base to python-1.1.1 (not 1.1.0) and adds the missing [1.1.1] reference link.
* Sync Agent Framework Python docs for PRs since 2026-04-22 Updates docs to reflect changes in microsoft/agent-framework Python PRs merged after MicrosoftDocs/semantic-kernel-pr#982 (2026-04-22). - get-started/workflows.md, AGENTS.md: rename 01-get-started/05_first_workflow.py -> 07_first_graph_workflow.py (microsoft/agent-framework#4238). - integrations/a2a.md: add Python section 'Exposing an Agent Framework agent over A2A' documenting A2AExecutor and the new agent_framework_to_a2a.py sample (microsoft/agent-framework#2403). - agents/providers/github-copilot.md: add Observability subsection in Python zone showing configure_otel_providers() and RawGitHubCopilotAgent (microsoft/agent-framework#5142). - agents/providers/microsoft-foundry.md: add 'Connecting to a deployed (hosted) Foundry agent' subsection covering allow_preview=True / v2 and explicit AIProjectClient session creation (microsoft/agent-framework#5447). - integrations/hyperlight.md: note that result_parser does not run on the sandbox path; tools must format in-sandbox themselves (microsoft/agent-framework#5424). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Defer #4238 (functional workflow API) doc updates to PR author Revert the get-started/workflows.md sample rename and the AGENTS.md mapping update. The author of microsoft/agent-framework#4238 will handle the docs (rename + new functional workflow page) in a dedicated follow-up. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Motivation and Context
This integration enables agent framework agents to communicate and execute as a A2A hosted agent server.
Description
Contribution Checklist