-
Notifications
You must be signed in to change notification settings - Fork 3.2k
A2A _serialize_value() corrupts JSON-native metadata types to strings #5183
Copy link
Copy link
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementation
Description
Bug Description
_serialize_value() in from_adk_event.py falls through to str() for JSON-native Python types (dict, list, bool, int, float), corrupting structured metadata values into their string representations during A2A event conversion.
Steps to Reproduce
from google.adk.a2a.converters.from_adk_event import _serialize_value
metadata = {"retry": True, "max_attempts": 3, "tags": ["alpha", "beta"]}
result = _serialize_value(metadata)
print(type(result), result)
# Actual: <class 'str'> "{'retry': True, 'max_attempts': 3, 'tags': ['alpha', 'beta']}"
# Expected: <class 'dict'> {'retry': True, 'max_attempts': 3, 'tags': ['alpha', 'beta']}Expected Behavior
JSON-native types (dict, list, str, bool, int, float) should be preserved as-is since they are already valid JSON values, not converted to strings.
Actual Behavior
All non-Pydantic values that aren't None are passed through str(), which corrupts structured data into Python repr strings.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementation