Skip to content

feat(a2a): upgrade a2a-sdk from >=0.3.4,<0.4 to >=1.0,<2 (A2A 1.0 spec)#5917

Open
waadarsh wants to merge 2 commits into
google:mainfrom
waadarsh:feat/upgrade-a2a-sdk-1x
Open

feat(a2a): upgrade a2a-sdk from >=0.3.4,<0.4 to >=1.0,<2 (A2A 1.0 spec)#5917
waadarsh wants to merge 2 commits into
google:mainfrom
waadarsh:feat/upgrade-a2a-sdk-1x

Conversation

@waadarsh
Copy link
Copy Markdown

@waadarsh waadarsh commented May 31, 2026

Summary

  • Upgrades `a2a-sdk` dependency from `>=0.3.4,<0.4` to `>=1.0,<2` (A2A 1.0 spec)
  • Migrates all A2A integration code from Pydantic-based types to Protocol Buffer (proto) types
  • Updates 16 source files and 15 test files across converters, executor, utils, and agent modules

Fixes #5056

Key changes

  • `Part` type: `TextPart`/`DataPart`/`FilePart` → flat proto `Part` with `WhichOneof("content")`
  • Enum prefixes: `TaskState.working` → `TASK_STATE_WORKING`, `Role.agent` → `ROLE_AGENT`
  • `TaskStatus.timestamp`: string `.isoformat()` → proto `Timestamp.FromDatetime()`
  • `AgentCard.url` → `supported_interfaces` list with `AgentInterface` (A2A 1.0 schema)
  • `A2AStarletteApplication` → `create_agent_card_routes()` / `create_jsonrpc_routes()` / `create_rest_routes()`
  • `DefaultRequestHandler` now requires `agent_card=` argument
  • `ClientCallContext`: `a2a.client.middleware` → `a2a.client.client`
  • `send_message()` now takes `SendMessageRequest` proto and yields `StreamResponse`
  • proto Struct metadata: use `"in"` + subscript instead of `.get()`
  • v1 SDK requires `Task` enqueued before `TaskStatusUpdateEvent`

Test plan

```
uv run pytest tests/unittests/a2a/ -q
```

```
301 passed, 0 skipped, 0 failed
```

  • Previously skipped tests (`test_user_follow_up_sends_task_id_with_input_required`) now pass using `add_a2a_routes_to_fastapi` (the v1 equivalent of the removed `A2AFastAPIApplication`)
  • Pylint score: 9.30/10 on all changed source files (baseline was 9.39/10 before migration)

Migrates all A2A integration code and tests from the Pydantic-based
a2a-sdk 0.3.x API to the Protocol Buffer (proto) based a2a-sdk 1.x
API, implementing the A2A 1.0 specification.

Breaking changes addressed:

- Part types: TextPart/DataPart/FilePart replaced by flat proto Part
  with WhichOneof("content") oneof pattern (text, url, raw, data)
- Enum prefixes: TaskState.working -> TASK_STATE_WORKING,
  Role.agent -> ROLE_AGENT (all enums now SCREAMING_SNAKE_CASE)
- Timestamps: TaskStatus.timestamp is now proto Timestamp
  (use .FromDatetime() instead of .isoformat() string)
- TaskStatusUpdateEvent.final field removed; finality via task state
- AgentCard.url moved to supported_interfaces list (AgentInterface)
  with protocolBinding + protocolVersion fields (A2A 1.0 schema)
- A2AStarletteApplication removed; replaced by create_agent_card_routes(),
  create_jsonrpc_routes(), create_rest_routes() builders
- DefaultRequestHandler now requires agent_card= constructor argument
- ClientCallContext moved: a2a.client.middleware -> a2a.client.client
- ClientConfig.supported_transports -> supported_protocol_bindings
- TransportProtocol enum values now uppercase (JSONRPC, HTTP_JSON)
- Client send_message() takes SendMessageRequest proto and yields
  StreamResponse (use .WhichOneof("payload") to dispatch)
- proto Struct metadata: use "in" + subscript instead of .get()
- AgentCard construction: use json_format.ParseDict() not **dict
- v1 SDK requires Task enqueued before TaskStatusUpdateEvent

Files changed: pyproject.toml, 16 source files, 15 test files

All 299 a2a unit + integration tests pass (2 skipped for removed
A2AFastAPIApplication which has no 1.x equivalent).

Fixes google#5056
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label May 31, 2026
Replace A2AFastAPIApplication (removed in a2a-sdk v1) with
FastAPI + add_a2a_routes_to_fastapi in the two input_required
follow-up tests. Also fix proto Task construction (remove 'kind'
field, use Role.ROLE_USER enum).

All 301 a2a tests now pass with 0 skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade a2a-sdk dependency to support A2A 1.0 spec

2 participants