Re-enable the change: Upgrade A2UI examples to v0.9 schema#759
Re-enable the change: Upgrade A2UI examples to v0.9 schema#759
Conversation
|
Make it a draft PR for now, and will change it to |
There was a problem hiding this comment.
Code Review
This pull request primarily focuses on migrating A2UI examples and agent configurations from version 0.8 to 0.9. Key changes include updating version constants from VERSION_0_8 to VERSION_0_9 across multiple agent files (agent.py, prompt_builder.py, __main__.py). The UI_DESCRIPTION prompts are adjusted to reflect the new updateDataModel.value property instead of dataModelUpdate.contents and variant: "primary" for buttons instead of primary: true. All example JSON files are updated to the 0.9 schema, introducing createSurface, updateComponents, and updateDataModel messages, along with camelCase icon names (e.g., calendarToday, locationOn). A new Python script, migrate_v08_to_v09.py, is added to automate this migration process, handling the transformation of message types, component properties, and data model structures. Additionally, the a2ui_examples.py and prompt_builder.py files in contact_multiple_surfaces are updated to dynamically load inline catalogs and examples based on the new versioning scheme. Review comments highlight the need to consistently use camelCase for icon names in the 0.9 schema and suggest a safer way to access dictionary keys in the migration script to prevent IndexError.
| m_val_key = [mk for mk in m_item.keys() if mk.startswith("value")][0] | ||
| m_val = m_item[m_val_key] |
There was a problem hiding this comment.
This list comprehension with index [0] is unsafe and will raise an IndexError if no key in m_item starts with "value". Using next() with a default value would be safer and more robust, similar to the implementation on line 189.
m_val_key = next((mk for mk in m_item.keys() if mk.startswith("value")), None)
if m_val_key is None:
continue
m_val = m_item[m_val_key]
I'm curious, what would stop us from reviewing and merging this now? |
|
(and nice work getting this done so fast, even with the rollback!!) |
The original PR was reviewed and merged, but with the ADK agent on v0.9 and renderer on v0.8, the samples stopped working. So we decided to wait until the v0.9 renderer is ready. |
Reverts the revert PR #758, which basically re-enables #751.