Conversation
Summary of ChangesHello @jezekra1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request represents a significant architectural upgrade, transitioning the AgentStack SDK and CLI to version 1 of the A2A protocol. The core change involves replacing Pydantic models with Protobuf-based types for all inter-agent communication, leading to a more standardized and efficient data exchange. This migration necessitated widespread code adjustments, from dependency updates and internal data structures to how extensions are managed and how messages and artifacts are constructed and validated. The aim is to enhance protocol robustness and pave the way for future features and interoperability. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request migrates the codebase to a new version of the A2A protocol, which appears to be based on protobuf v1 instead of a previous version. The changes are extensive, touching many files to adapt to the new data types and API contracts. The core logic seems to be preserved, but refactored to work with protobuf messages. I've found a few critical issues related to incorrect handling of the new protobuf message objects, which will cause runtime errors. Overall, the migration is a significant undertaking and these fixes should help ensure its stability.
| except A2AClientHTTPError as ex: | ||
| card_data = json.dumps( | ||
| agent_card.model_dump(include={"url", "additional_interfaces", "preferred_transport"}), indent=2 | ||
| pick(MessageToDict, agent_card(include={"url", "additional_interfaces", "preferred_transport"})), |
There was a problem hiding this comment.
The arguments to the pick function seem to be incorrect. The pick utility expects a dictionary as its first argument, but MessageToDict is being passed, which is a function. Additionally, agent_card is a protobuf message and is not callable with an include keyword argument.
The intention seems to be to convert the agent_card to a dictionary and then select specific keys. The correct implementation should be to first call MessageToDict(agent_card) and then use pick on the resulting dictionary.
| pick(MessageToDict, agent_card(include={"url", "additional_interfaces", "preferred_transport"})), | |
| pick(MessageToDict(agent_card, preserving_proto_field_name=True), {"url", "additional_interfaces", "preferred_transport"}), |
| if message.metadata and self.spec.URI in message.metadata and message.parts: | ||
| message.parts = [part for part in message.parts if not isinstance(part.root, TextPart)] | ||
| message.parts.clear() | ||
| message.parts.extend([part for part in message.parts if "text" not in part]) |
There was a problem hiding this comment.
The expression if "text" not in part is not a valid way to check for the presence of a field in a protobuf message. This will likely raise a TypeError. You should use the HasField() method instead.
| message.parts.extend([part for part in message.parts if "text" not in part]) | |
| message.parts.extend([part for part in message.parts if not part.HasField("text")]) |
| case FileWithBytes(bytes=content, name=filename, mime_type=content_type): | ||
| yield LoadedFileWithBytes(content=base64.b64decode(content), filename=filename, content_type=content_type) | ||
|
|
||
| elif "raw" in part: # pyrefly: ignore [not-iterable] |
There was a problem hiding this comment.
The expression if "raw" in part: is not a valid way to check for the presence of a field in a protobuf message. This will likely raise a TypeError. You should use the HasField() method instead.
| elif "raw" in part: # pyrefly: ignore [not-iterable] | |
| elif part.HasField("raw"): # pyrefly: ignore [not-iterable] |
81d7482 to
fd6dcc8
Compare
58c5734 to
cd25080
Compare
Upgrade Python a2a-sdk to v1 with protobuf-based types. Migrate server, CLI and SDK to the new type structure. Refactor dependency management.
Signed-off-by: Radek Ježek <radek.jezek@ibm.com>
- Wrap all send_message() calls with SendMessageRequest(message=...) - Fix pushNotificationConfig assertion (fields now flattened) - Fix invalid request error code assertion (-32600 instead of -32601) Signed-off-by: Radek Ježek <radek.jezek@ibm.com>
2ca17bb to
42ddd12
Compare
Summary
Linked Issues
Documentation
If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why.