Skip to content

Python: [BREAKING] Migrate agent-framework-a2a to a2a-sdk v1.0#5752

Merged
moonbox3 merged 2 commits into
microsoft:mainfrom
giles17:a2a-v1-migration
May 11, 2026
Merged

Python: [BREAKING] Migrate agent-framework-a2a to a2a-sdk v1.0#5752
moonbox3 merged 2 commits into
microsoft:mainfrom
giles17:a2a-v1-migration

Conversation

@giles17

@giles17 giles17 commented May 11, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Migrates the Python agent-framework-a2a package from a2a-sdk v0.3.x to v1.0, aligning with the A2A protocol v1.0 release. This is the Python counterpart of the .NET migration in #5423.

Closes #5661

Description

Upgrades the a2a-sdk dependency from >=0.3.5,<0.3.24 to >=1.0.0,<2 and migrates all source code, tests, samples, and documentation to the v1.0 API.

Source changes (_agent.py, _a2a_executor.py):

  • Types are now protobuf-based: Part replaces TextPart/FilePart/DataPart
  • Enums use SCREAMING_SNAKE_CASE (e.g. TaskState.TASK_STATE_COMPLETED)
  • Roles: Role.ROLE_AGENT, Role.ROLE_USER
  • Client API: SendMessageRequest wrapper, subscribe() replaces resubscribe()
  • Stream yields StreamResponse with WhichOneof('payload')
  • TaskUpdater.update_status: final parameter removed
  • Metadata handled via protobuf MessageToDict

Server/sample changes:

  • A2AStarletteApplication replaced by Starlette + create_agent_card_routes() / create_jsonrpc_routes()
  • DefaultRequestHandler now requires agent_card parameter
  • AgentCard.url removed; use supported_interfaces with AgentInterface

Tests:

  • All 114 tests (78 agent + 33 executor + 3 utils) migrated and passing
  • Zero tests removed

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? Yes — requires a2a-sdk>=1.0.0. This is a breaking change in the upstream dependency, not in Agent Framework's public API.

Upgrade the a2a-sdk dependency from v0.3.x to v1.0.0 and migrate all
source, tests, samples, and documentation to the v1.0 API.

Key changes:
- Dependency: a2a-sdk>=1.0.0,<2 (was >=0.3.5,<0.3.24)
- Types are now protobuf-based: Part replaces TextPart/FilePart/DataPart
- Enums use SCREAMING_SNAKE_CASE (e.g. TaskState.TASK_STATE_COMPLETED)
- Roles: Role.ROLE_AGENT, Role.ROLE_USER
- Client: SendMessageRequest wrapper, subscribe() replaces resubscribe()
- Server: A2AStarletteApplication replaced by Starlette + route factories
- DefaultRequestHandler now requires agent_card parameter
- TaskUpdater: final parameter removed, add_artifact gains last_chunk
- AgentCard.url removed; use supported_interfaces with AgentInterface
- Stream yields StreamResponse with WhichOneof('payload')

Closes microsoft#5661

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 19:48
@moonbox3 moonbox3 added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels May 11, 2026
@moonbox3

moonbox3 commented May 11, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/a2a/agent_framework_a2a
   _a2a_executor.py900100% 
   _agent.py2581793%164, 351, 356, 358, 524, 540, 543, 548, 568, 589, 617, 633, 643, 654, 661–662, 703
TOTAL33842390788% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
6662 30 💤 0 ❌ 0 🔥 1m 43s ⏱️

@giles17 giles17 changed the title Python: Migrate agent-framework-a2a to a2a-sdk v1.0 [BREAKING] Python: Migrate agent-framework-a2a to a2a-sdk v1.0 May 11, 2026
@giles17 giles17 changed the title [BREAKING] Python: Migrate agent-framework-a2a to a2a-sdk v1.0 Python: [BREAKING] Migrate agent-framework-a2a to a2a-sdk v1.0 May 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Migrates the Python agent-framework-a2a package and related samples/tests/docs from a2a-sdk 0.3.x to 1.0.x, updating protocol types, enums, streaming payload handling, and server route setup to align with A2A protocol v1.0.

Changes:

  • Upgraded a2a-sdk dependency constraints and regenerated uv.lock for the new dependency graph.
  • Refactored the A2A agent + executor implementation to use protobuf-backed Part/StreamResponse, updated enum/role values, and updated client request wrappers (SendMessageRequest, SubscribeToTaskRequest, GetTaskRequest).
  • Updated samples, docs, and unit tests to the new server route model (Starlette + create_*_routes) and updated A2A types.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/uv.lock Locks a2a-sdk v1.x and new transitive dependencies.
python/packages/a2a/pyproject.toml Updates a2a-sdk requirement to >=1.0.0,<2.
python/packages/a2a/agent_framework_a2a/_agent.py Migrates agent streaming/client logic to v1 StreamResponse + protobuf metadata handling.
python/packages/a2a/agent_framework_a2a/_a2a_executor.py Migrates executor task creation + content-to-Part mapping to v1 APIs.
python/packages/a2a/tests/test_a2a_agent.py Updates agent tests to StreamResponse payload model and new enums/parts.
python/packages/a2a/tests/test_a2a_executor.py Updates executor tests for new task creation helper and enums/parts.
python/packages/a2a/AGENTS.md Updates hosting guidance to Starlette route factories and new handler requirements.
python/samples/04-hosting/a2a/agent_framework_to_a2a.py Updates sample hosting app from A2AStarletteApplication to Starlette routes + supported_interfaces.
python/samples/04-hosting/a2a/a2a_server.py Updates sample server to new DefaultRequestHandler signature and Starlette routes.
python/samples/04-hosting/a2a/agent_definitions.py Updates AgentCard construction to use supported_interfaces instead of url.
python/samples/04-hosting/a2a/agent_executor.py Updates sample executor output to new Part/Role/TaskState enum names.

Comment thread python/packages/a2a/agent_framework_a2a/_agent.py
Comment thread python/packages/a2a/agent_framework_a2a/_agent.py Outdated
Comment thread python/packages/a2a/agent_framework_a2a/_agent.py

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 2 | Confidence: 91% | Result: All clear

Reviewed: Test Coverage, Design Approach


Automated review by giles17's agents

- Raise ValueError with clear message when transport negotiation fails
  and no fallback URL is available (neither url arg nor supported_interfaces)
- Remove unused task_id local in status_update branch
- Inline artifact_event.task_id directly in artifact_update branch

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@moonbox3 moonbox3 added this pull request to the merge queue May 11, 2026
Merged via the queue into microsoft:main with commit 4ad96b6 May 11, 2026
36 checks passed
learn-build-service-prod Bot pushed a commit to MicrosoftDocs/semantic-kernel-docs that referenced this pull request May 20, 2026
Update the Python zone pivot in integrations/a2a.md to reflect
breaking changes from a2a-sdk v0.3 to v1.0 (microsoft/agent-framework#5752
and microsoft/agent-framework#5849):

- Replace A2AStarletteApplication with Starlette + route helpers
- Add agent_card parameter to DefaultRequestHandler
- Replace AgentCard.url with supported_interfaces/AgentInterface
- Fix camelCase to snake_case (defaultInputModes -> default_input_modes)
- Add rpc_url parameter to create_jsonrpc_routes
- Fix resubscribe -> subscribe terminology
- Update A2AExecutor description (remove stale save_thread/get_thread)
- Add language parity table
- Update ms.date

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 Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: A2A SDK V1.0 Migration

4 participants