fix: migrate to a2a-sdk v1.0 protobuf types#59
Conversation
BREAKING: Updates all code from a2a-sdk v0.x Pydantic models to v1.0 protobuf-generated types: - TextPart/FilePart/DataPart → unified Part with text/raw/url/data fields - MessageSendParams → SendMessageRequest - Role.user/Role.agent → Role.ROLE_USER/Role.ROLE_AGENT - FileWithBytes/FileWithUri → Part(raw=...) / Part(url=...) - new_agent_text_message() → construct Message directly - RequestContext now requires ServerCallContext - Message metadata now uses protobuf Struct - DataPart data field now uses protobuf Value Also updates: - capiscio_sdk executor to handle protobuf Message serialization via MessageToDict (was model_dump() only) - pyproject.toml dependency: a2a-sdk>=1.0.0 - examples/simple_agent for v1.0 compatibility Fixes cross-product E2E test ImportError: cannot import name 'TextPart' from 'a2a.types'
|
✅ Documentation validation passed!
|
|
✅ All checks passed! Ready for review. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
There was a problem hiding this comment.
Pull request overview
Migrates the SDK integration points from a2a-sdk v0.x Pydantic models to v1.0 protobuf-generated types, updating tests and examples accordingly and adjusting message serialization in the security executor.
Changes:
- Updated integration tests to construct
a2a.types.Message/Part/...protobuf types (incl.SendMessageRequest,ServerCallContext,Struct/Value). - Updated
CapiscioSecurityExecutorto serialize protobuf messages viagoogle.protobuf.json_format.MessageToDict. - Bumped dependency constraint to
a2a-sdk>=1.0.0and refreshed simple-agent examples.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/integration/test_real_executor.py |
Migrates integration tests to protobuf A2A types and updates request/response message construction. |
capiscio_sdk/executor.py |
Adds protobuf message-to-dict conversion path for validation. |
examples/simple_agent/test_client.py |
Switches example client request payload serialization to protobuf MessageToDict. |
examples/simple_agent/agent_executor.py |
Updates example agent executor to emit protobuf Message events instead of helper constructors. |
pyproject.toml |
Updates dependency to a2a-sdk>=1.0.0. |
Comments suppressed due to low confidence (1)
capiscio_sdk/executor.py:105
identifier = message_dict.get("message_id") ...assumes snake_case keys. If the message dict is produced via protobuf JSON mapping (or Pydantic aliases), the key may bemessageId, which would make rate limiting/caching identifiers inconsistent. Consider checking bothmessage_idandmessageId(or deriving the identifier directly from the message object) to keep behavior consistent across model types.
# Extract identifier for rate limiting
identifier = message_dict.get("message_id") or message.message_id
| @@ -13,9 +13,11 @@ | |||
| import pytest | |||
| import base64 | |||
| if hasattr(message, 'model_dump'): | ||
| message_dict = message.model_dump() | ||
| elif ProtobufMessage is not None and isinstance(message, ProtobufMessage): | ||
| message_dict = MessageToDict(message, preserving_proto_field_name=True) | ||
| else: | ||
| message_dict = {} |
Summary
Migrates all code from a2a-sdk v0.x Pydantic models to v1.0 protobuf-generated types. This fixes the Cross-Product E2E Tests CI failure that has been failing on every main branch commit:
Changes
Type Migration (tests/integration/test_real_executor.py)
TextPart(text=...)Part(text=...)FilePart(file=FileWithBytes(...))Part(raw=..., media_type=..., filename=...)FilePart(file=FileWithUri(...))Part(url=..., media_type=..., filename=...)DataPart(data={...})Part(data=Value())viaParseDictMessageSendParams(message=msg)SendMessageRequest(message=msg)Role.user/Role.agentRole.ROLE_USER/Role.ROLE_AGENTnew_agent_text_message(text)Message(role=ROLE_AGENT, parts=[Part(text=...)])RequestContext(request=params)RequestContext(call_context=ServerCallContext(), request=params)SDK Compatibility (capiscio_sdk/executor.py)
MessageToDictsupport for message-to-dict conversionmodel_dump(), falling back to{}for protobuf messagesMessageobjects for validationDependency Update (pyproject.toml)
a2a-sdk>=0.1.0→a2a-sdk>=1.0.0Examples (examples/simple_agent/)
agent_executor.pyandtest_client.pyfor v1.0 typesTesting
test_real_executor.pyupdated