-
Notifications
You must be signed in to change notification settings - Fork 270
Description
Describe the bug
There is a critical metadata key mismatch between the Python and Java implementations of the ADK A2A conversion for GenAI parts.
In Python, the type metadata key is generated using get_adk_metadata_key('type'), which prepends an adk prefix (resulting in "adk_type").
In Java, the library attempts to read the metadata using constants like PartConverter.A2A_DATA_PART_METADATA_TYPE_KEY, which does not include the adk_ prefix (it is just "type").
This prevents the Java side from correctly identifying types like function_call
Python Side: Convert a GenAI function call part to A2A.
python
Inside convert_genai_part_to_a2a_part
Python generates: {"adk_type": "function_call"}
a2a_part.metadata = {_get_adk_metadata_key('type'): 'function_call'}
Java Side: The ADK tries to extract the author.
java
// In com.google.adk.a2a.extractAuthorFromMetadata
Map<String, Object> metadata = dataPart.getMetadata();
// PartConverter.A2A_DATA_PART_METADATA_TYPE_KEY is "type"
// Result is empty because the actual key in the map is "adk_type"
String type = metadata.getOrDefault(PartConverter.A2A_DATA_PART_METADATA_TYPE_KEY, "").toString();
Expected behavior
The metadata keys should be identical across all SDKs. If Python uses adk_type, then Java's PartConverter.A2A_DATA_PART_METADATA_TYPE_KEY should also be adk_type,
or check both value to Compatible with old verion。
OS: All
Java version: 17+
ADK version: 0.4.0