Skip to content

Python: feat: Add Agent Framework to A2A bridge support#2403

Merged
moonbox3 merged 53 commits intomicrosoft:mainfrom
Shubham-Kumar-2000:agent_framework_to_a2a
Apr 24, 2026
Merged

Python: feat: Add Agent Framework to A2A bridge support#2403
moonbox3 merged 53 commits intomicrosoft:mainfrom
Shubham-Kumar-2000:agent_framework_to_a2a

Conversation

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor

@Shubham-Kumar-2000 Shubham-Kumar-2000 commented Nov 23, 2025

Motivation and Context

This integration enables agent framework agents to communicate and execute as a A2A hosted agent server.

Description

  • Implement A2A event adapter for converting agent messages to A2A protocol
  • Implement A2A executor for running agents in A2A environment
  • Add comprehensive unit tests for event adapter, 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

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

- 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.
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Nov 23, 2025
@github-actions github-actions Bot changed the title feat: Add Agent Framework to A2A bridge support Python: feat: Add Agent Framework to A2A bridge support Nov 23, 2025
- 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.
Copy link
Copy Markdown
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

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

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.

Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_executor.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_event_adapter.py Outdated
Comment thread python/packages/core/agent_framework/_threads.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_executor.py
- 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.
@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

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 AgentThreadStore I have started a discussion to finalize the approach.
#2463

Do let me know if any other changes are required.

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

I have successfully addressed all mentioned review comments.
Please re-review.

@eavanvalkenburg
Copy link
Copy Markdown
Member

@Shubham-Kumar-2000 we have redone the threads, now called sessions, and the context providers,please update if you can!

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

@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.

- 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.
@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

Hi @eavanvalkenburg I have addressed all new review comments.

@eavanvalkenburg
Copy link
Copy Markdown
Member

@Shubham-Kumar-2000 one of the checks fail, please run the pre-commit jobs, it looks like a ruff issue

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

Hi @eavanvalkenburg I have fixed the lint issue and also merged with master.

Copy link
Copy Markdown
Contributor

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 adds Python “hosting-side” support to expose Agent Framework agents as A2A-compliant servers, complementing the existing A2A client integration.

Changes:

  • Introduces A2AExecutor to bridge SupportsAgentRun agents into the A2A server execution model (including streaming support).
  • Updates Agent Framework agent_framework.a2a exports/type stubs and the agent-framework-a2a package 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).

Comment thread python/packages/a2a/agent_framework_a2a/_a2a_executor.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_executor.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_executor.py
Comment thread python/packages/a2a/agent_framework_a2a/_a2a_executor.py
@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

Hi @eavanvalkenburg I have made changes regarding the review comments from Copilot

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

Hi @eavanvalkenburg I have fixed the failing checks.

But it required to move one function used in both A2aAgent and A2aExecutor to be extracted to a common utils.

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

Please let me know if any anything else is required from my end

@Shubham-Kumar-2000
Copy link
Copy Markdown
Contributor Author

Hi @eavanvalkenburg
This will require a re review from you as the previous one got stale due to copilot comments & fixes.

@moonbox3 moonbox3 added this pull request to the merge queue Apr 24, 2026
Merged via the queue into microsoft:main with commit b00465d Apr 24, 2026
32 checks passed
@github-project-automation github-project-automation Bot moved this from Community PR to Done in Agent Framework Apr 24, 2026
moonbox3 added a commit to moonbox3/agent-framework that referenced this pull request Apr 24, 2026
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.
moonbox3 added a commit that referenced this pull request Apr 24, 2026
* 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.
learn-build-service-prod Bot pushed a commit to MicrosoftDocs/semantic-kernel-docs that referenced this pull request Apr 27, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python requested-info

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants