ci(python): run a2ui-agent-sdk tests on a2a-sdk 1.x - #2363
Conversation
ADK 2.x already pins google-adk 2.3 and accepts a2a-sdk <2, but a2ui-agent-sdk still constructed pydantic Part(root=DataPart) and called RequestContext.add_activated_extension. Those APIs are gone in a2a-sdk 1.x (protobuf Part + call_context.state). Add version-agnostic helpers so create_a2ui_part, is_a2ui_part, get_a2ui_data, extract_user_action, and try_activate_a2ui_extension work on both generations. Widen the published a2a-sdk pin to <2 while keeping the workspace lock on 0.3 until samples migrate.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: william <651833+WillBeebe@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: william <651833+WillBeebe@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: william <651833+WillBeebe@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request introduces version-agnostic compatibility helpers in _compat.py to support both a2a-sdk 0.3.x and 1.x. It updates the SDK to use these helpers for creating and managing parts and agent extensions, widens the a2a-sdk dependency range, and adds comprehensive unit tests. One high-severity issue was identified in _compat.py where calling MessageToDict on part.metadata (a protobuf map container) will raise a TypeError at runtime; the reviewer suggested converting it directly using dict(part.metadata) instead.
| from google.protobuf.json_format import MessageToDict | ||
|
|
||
| # metadata is a protobuf map; HasField() raises ValueError on maps. | ||
| return MessageToDict(part.metadata) if part.metadata else {} |
There was a problem hiding this comment.
Calling MessageToDict on part.metadata (which is a protobuf map container, not a Message instance) will raise a TypeError at runtime. Since part.metadata is a standard protobuf map of string to string, you can simply convert it to a plain Python dictionary using dict(part.metadata).
| from google.protobuf.json_format import MessageToDict | |
| # metadata is a protobuf map; HasField() raises ValueError on maps. | |
| return MessageToDict(part.metadata) if part.metadata else {} | |
| return dict(part.metadata) |
MessageToDict(part.metadata) is enough; HasField on a map raises ValueError in the Python protobuf runtime. Signed-off-by: william <651833+WillBeebe@users.noreply.github.com>
Add a sibling Python CI job that installs only a2ui-agent-sdk with a2a-sdk>=1 in an isolated venv (workspace members still pin <0.4, so uv sync --all-packages cannot resolve 1.x). Run tests/a2a, which go through _compat. Also stop calling HasField on protobuf map metadata; that raises ValueError on a2a-sdk 1.x. Signed-off-by: william <651833+WillBeebe@users.noreply.github.com>
98b7b8a to
00b9288
Compare
Stacked on #2337. Only the last commit is new (
ci(python): run a2ui-agent-sdk tests on a2a-sdk 1.x). Review againstWillBeebe:feat/a2a-sdk-1x-part-typesif this PR still contains #2337.Why
#2337 widens the published
a2ui-agent-sdkpin toa2a-sdk>=0.3.0,<2, but workspace CI stays on 0.3 (constraint-dependenciesplus sample packages that still pin<0.4). TheIS_A2A_V1branch of_compatis untested in CI.A full clone of
python-cicannotuv sync --all-packageson 1.x: other workspace members (e.g.file-upload-summarizer) still requirea2a-sdk<0.4.What
Sibling job Python CI (a2a-sdk 1.x):
/tmpso workspaceconstraint-dependenciesdo not apply)a2ui-core+a2ui-agent-sdk+a2a-sdk>=1.0.0,<2pytest agent_sdks/python/a2ui_agent/tests/a2a— the helpers that go through_compatDefault
python-ciis unchanged (0.3, full workspace).Also:
part_metadatano longer callsHasFieldon the protobuf map (raisesValueErroron 1.x).Locally: 10 passed on a2a-sdk 1.1.2 (
IS_A2A_V1=True).Out of scope
Part.rootrewrites (follow-up)tests/adk/tests/conformancestill import 0.3DataPartat test-construction timeconstraint-dependencies