-
Notifications
You must be signed in to change notification settings - Fork 258
Fix A2A metadata key prefix for cross-language compatibility #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @fsonntag, 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 addresses a critical cross-language compatibility issue within the A2A protocol, specifically when Java agents are evaluated by Python. By standardizing the metadata key prefixes used by Java to match Python's expectations, it ensures that tool calls are correctly tracked across the two languages, thereby improving the robustness and interoperability of the A2A system. 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. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses a cross-language compatibility issue between the Java and Python A2A implementations by adding the expected adk_ prefix to metadata keys. The use of a dedicated constant for the prefix is a good choice for maintainability. The change is focused, well-explained, and effectively resolves the issue. I have one suggestion to improve the clarity of a new comment.
a2a/src/main/java/com/google/adk/a2a/converters/PartConverter.java
Outdated
Show resolved
Hide resolved
36802a3 to
50ccfcd
Compare
50ccfcd to
034ada1
Compare
Fix A2A metadata key prefix for cross-language compatibility
Problem
When evaluating Java agents from Python via A2A protocol, tool calls were not being tracked because metadata keys didn't match Python's expectations.
Root cause: Python expects metadata keys with
adk_prefix (e.g.,adk_type), but Java was sending unprefixed keys (e.g.,type).Solution
Added
ADK_METADATA_KEY_PREFIX = "adk_"constant and prefixed metadata keys to align with Python's convention:A2A_DATA_PART_METADATA_TYPE_KEY→"adk_type"A2A_DATA_PART_METADATA_IS_LONG_RUNNING_KEY→"adk_is_long_running"Metadata values (like
"function_call") remain unprefixed as expected.Changes
File:
a2a/src/main/java/com/google/adk/a2a/converters/PartConverter.javaADK_METADATA_KEY_PREFIXconstant at line 33Python Reference
Python's implementation using
_get_adk_metadata_key()helper:https://github.com/google/adk/blob/main/adk-python/src/google/adk/a2a/converters/part_converter.py#L36-L41
Python adds prefix when reading metadata:
https://github.com/google/adk/blob/main/adk-python/src/google/adk/a2a/converters/part_converter.py#L93-L98
Testing
Verified with cross-language A2A evaluation showing tool calls now properly tracked.