Skip to content

Comments

Update rizzchart sample#620

Open
nan-yu wants to merge 4 commits intogoogle:mainfrom
nan-yu:update-rizzchart-sample
Open

Update rizzchart sample#620
nan-yu wants to merge 4 commits intogoogle:mainfrom
nan-yu:update-rizzchart-sample

Conversation

@nan-yu
Copy link
Collaborator

@nan-yu nan-yu commented Feb 11, 2026

Description

It updates the sample to use the A2uiSchemaManager from the a2ui-agent python SDK.

Tested:

  • The rizzcharts Angular client successfully connected to the rizzcharts agent and rendered the response correctly.
rizzcharts_demo.mov
  • The orchestator Angular client successfully connected to the orchestator agent and all subagents.
orchestrator_demo.mov

Pre-launch Checklist

If you need help, consider asking for advice on the discussion board.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 introduces a significant and valuable refactoring by creating the A2uiSchemaManager to centralize schema loading, management, and prompt generation. This makes the system more robust and easier to extend. The use of build hooks to package schema files and the clear separation of concerns in the new inference package are excellent design choices. However, I've identified a few issues, including a critical one where validation is disabled in one of the samples, which should be addressed before merging.

@nan-yu nan-yu force-pushed the update-rizzchart-sample branch 2 times, most recently from f398270 to 6bb60e0 Compare February 12, 2026 00:25
@nan-yu nan-yu force-pushed the update-rizzchart-sample branch from 6bb60e0 to f350823 Compare February 12, 2026 18:13
@google google deleted a comment from gemini-code-assist bot Feb 12, 2026
@zeroasterisk
Copy link
Collaborator

Heads up: this PR overlaps with #559 on the CI workflow changes. Will need a rebase after #559 merges.

@nan-yu nan-yu force-pushed the update-rizzchart-sample branch from f350823 to 9e911d4 Compare February 13, 2026 21:47
@nan-yu nan-yu force-pushed the update-rizzchart-sample branch from 9e911d4 to f9e0676 Compare February 23, 2026 22:28
@nan-yu nan-yu requested a review from crisbeto as a code owner February 23, 2026 22:28
@nan-yu nan-yu force-pushed the update-rizzchart-sample branch 2 times, most recently from ca42830 to b70d611 Compare February 23, 2026 23:12
It updates the sample to use the A2uiSchemaManager from the a2ui-agent python SDK.

Tested:
- [x] The `rizzcharts` Angular client successfully connected to the
  `rizzcharts` agent and rendered the response correctly.
@nan-yu nan-yu force-pushed the update-rizzchart-sample branch from b70d611 to 941058f Compare February 23, 2026 23:18
@nan-yu
Copy link
Collaborator Author

nan-yu commented Feb 23, 2026

It includes the following changes:

Follow up:

  • Move the SDK to the root directory instead of putting it in the inference folder.

@gemini-code-assist
Copy link
Contributor

gemini-code-assist bot commented Feb 23, 2026

Summary of Changes

This pull request overhauls the A2UI schema handling within the Python SDK, centralizing schema management, validation, and payload fixing into dedicated classes. This change aims to improve the reliability and maintainability of A2UI integrations by providing a more structured and robust framework for defining and validating UI components and data. The rizzcharts sample agent has been updated to reflect these new patterns, demonstrating the streamlined approach to A2UI implementation.

Highlights

  • A2UI Schema Management Refactor: The A2UI schema management and validation logic has been significantly refactored, moving from direct schema handling and a standalone validation.py file to a centralized A2uiSchemaManager and A2uiCatalog system. This enhances modularity and robustness in handling A2UI definitions.
  • Introduction of A2uiPayloadFixer: A new A2uiPayloadFixer class was introduced to automatically handle common issues in A2UI JSON payloads generated by LLMs, such as trailing commas, ensuring better resilience against malformed output.
  • Enhanced A2UI Validation: The core validation logic, including checks for component integrity, topology (circular references, orphaned components), recursion limits, and JSON Pointer syntax, has been integrated into the A2uiValidator class within the A2uiCatalog. This provides comprehensive validation for A2UI messages.
  • Rizzcharts Sample Update: The rizzcharts sample agent was updated to utilize the new A2uiSchemaManager for providing A2UI catalogs and examples, streamlining its integration with the A2UI SDK.
  • JSON Path Standardization: Numerous example JSON files across various samples were updated to use absolute JSON Pointer paths (e.g., /key instead of key), standardizing how data is referenced within A2UI components.
Changelog
  • a2a_agents/python/a2ui_agent/src/a2ui/extension/send_a2ui_to_client_toolset.py
    • Updated SendA2uiToClientToolset to use a2ui_catalog and a2ui_examples instead of a2ui_schema.
    • Removed imports for wrap_as_json_array and validate_a2ui_json.
    • Modified _SendA2uiJsonToClientTool to utilize A2uiCatalog and A2uiExamplesProvider for schema and example resolution.
    • Replaced direct JSON schema validation and manual trailing comma fixing with a2ui_catalog.payload_fixer.fix.
  • a2a_agents/python/a2ui_agent/src/a2ui/extension/validation.py
    • Removed the file, as its validation logic was refactored and moved into a2ui/inference/schema/validator.py and a2ui/inference/schema/payload_fixer.py.
  • a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/catalog.py
    • Added a payload_fixer property to A2uiCatalog to provide access to the new payload fixing utility.
  • a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/constants.py
    • Introduced VERSION_0_8 and VERSION_0_9 constants for clearer version referencing.
  • a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/payload_fixer.py
    • Added new file payload_fixer.py containing the A2uiPayloadFixer class.
    • Implemented _remove_trailing_commas method to clean up malformed JSON strings.
    • Implemented _parse method to parse JSON and auto-wrap single objects into lists.
    • Implemented fix method to apply autofixes and validate A2UI JSON payloads.
  • a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/validator.py
    • Imported re and added constants for JSON Pointer pattern, recursion limits, and component keys.
    • Updated A2uiValidator to include comprehensive validation logic for component integrity, topology, recursion limits, and path syntax.
    • Modified _build_0_8_validator to correctly handle common_types.json references and use referencing library.
    • Updated _build_0_9_validator to explicitly use DRAFT202012 for resource contents in the registry.
  • a2a_agents/python/a2ui_agent/tests/extension/test_send_a2ui_to_client_toolset.py
    • Updated tests to use A2uiCatalog mocks and a2ui_catalog/a2ui_examples parameters.
    • Removed TEST_A2UI_SCHEMA and related schema-specific validation tests.
    • Modified test_send_tool_process_llm_request to assert on rendered_catalog and examples instructions.
    • Updated test_send_tool_run_async_valid and test_send_tool_run_async_valid_list to mock payload_fixer.fix.
    • Removed test_send_tool_run_async_handles_trailing_comma as this logic is now in A2uiPayloadFixer.
  • a2a_agents/python/a2ui_agent/tests/inference/test_payload_fixer.py
    • Added new test file test_payload_fixer.py to cover the functionality of A2uiPayloadFixer.
  • a2a_agents/python/a2ui_agent/tests/inference/test_validator.py
    • Added VERSION_0_8 and VERSION_0_9 imports.
    • Expanded catalog_0_9 fixture to include more component definitions (Image, Icon, Column, Card, Button, List) and Action type.
    • Added root property to beginRendering in catalog_0_8 fixture.
    • Introduced test_catalog fixture to parameterize tests for both v0.8 and v0.9 catalogs.
    • Added extensive tests for duplicate IDs, missing root, dangling references, self-references, circular references, function call recursion, orphaned components, global recursion limits, template reachability, and invalid paths.
  • a2a_agents/python/a2ui_agent/tests/integration/verify_load_real.py
    • Updated JSON Pointer paths in various components from relative (key) to absolute (/key).
  • a2a_agents/python/a2ui_agent/tests/test_validation.py
    • Removed the file, as its validation logic was refactored and moved into a2ui/inference/schema/validator.py and a2ui/inference/schema/payload_fixer.py.
  • samples/agent/adk/contact_lookup/examples/action_confirmation.json
    • Updated JSON Pointer paths in modal-title and modal-message components from relative (actionTitle, actionMessage) to absolute (/actionTitle, /actionMessage).
  • samples/agent/adk/contact_lookup/examples/contact_card.json
    • Updated JSON Pointer paths in various components (e.g., profile_image, user_heading, calendar_primary_text) from relative to absolute.
  • samples/agent/adk/contact_lookup/examples/contact_list.json
    • Updated JSON Pointer paths in various components (e.g., template-image, template-name, template-title) from relative to absolute.
  • samples/agent/adk/contact_multiple_surfaces/examples/action_confirmation.json
    • Updated JSON Pointer paths in actionTitle and actionMessage from relative to absolute.
  • samples/agent/adk/contact_multiple_surfaces/examples/chart_node_click.json
    • Updated JSON Pointer paths in various components (e.g., profile_image, name, title, team) from relative to absolute.
  • samples/agent/adk/contact_multiple_surfaces/examples/contact_card.json
    • Updated JSON Pointer paths in various components (e.g., profile_image, name, title, team) from relative to absolute.
  • samples/agent/adk/contact_multiple_surfaces/examples/contact_list.json
    • Updated JSON Pointer paths in various components (e.g., template-image, template-name, template-title) from relative to absolute.
  • samples/agent/adk/contact_multiple_surfaces/examples/multi_surface.json
    • Updated JSON Pointer paths in various components (e.g., profile_image, name, title, team, hierarchy) from relative to absolute.
  • samples/agent/adk/contact_multiple_surfaces/examples/org_chart.json
    • Updated JSON Pointer path in OrgChart component from relative (hierarchy) to absolute (/hierarchy).
  • samples/agent/adk/restaurant_finder/examples/booking_form.json
    • Updated JSON Pointer paths in various components (e.g., booking-title, restaurant-image, party-size-field) from relative to absolute.
  • samples/agent/adk/restaurant_finder/examples/confirmation.json
    • Updated JSON Pointer paths in various components (e.g., confirm-title, confirm-image, confirm-details) from relative to absolute.
  • samples/agent/adk/restaurant_finder/examples/single_column_list.json
    • Updated JSON Pointer paths in various components (e.g., title-heading, template-image, template-name) from relative to absolute.
  • samples/agent/adk/restaurant_finder/examples/two_column_list.json
    • Updated JSON Pointer path in title-heading component from relative (title) to absolute (/title).
  • samples/agent/adk/rizzcharts/main.py
    • Updated imports to include A2uiSchemaManager, CustomCatalogConfig, get_a2ui_catalog, and get_a2ui_examples.
    • Initialized A2uiSchemaManager with version, example paths, and custom catalogs.
    • Modified RizzchartsAgent instantiation to pass base_url, schema_manager, and new A2UI providers.
    • Removed manual schema loading and ComponentCatalogBuilder instantiation.
    • Updated A2AStarletteApplication to use agent.get_agent_card() instead of agent_executor.get_agent_card().
  • samples/agent/adk/rizzcharts/agent.py
    • Updated imports to use A2uiCatalogProvider, A2uiExamplesProvider, and A2uiSchemaManager.
    • Removed wrap_as_json_array import.
    • Modified RizzchartsAgent constructor to accept base_url, schema_manager, a2ui_catalog_provider, and a2ui_examples_provider.
    • Replaced get_instructions method with a direct call to schema_manager.generate_system_prompt.
    • Updated get_agent_card to use schema_manager.get_agent_extension() for capabilities.
  • samples/agent/adk/rizzcharts/agent_executor.py
    • Removed imports for A2UI_CATALOG_URI_STATE_KEY, RIZZCHARTS_CATALOG_URI, RizzchartsAgent, and ComponentCatalogBuilder.
    • Updated get_a2ui_schema to get_a2ui_catalog and introduced get_a2ui_examples.
    • Modified RizzchartsAgentExecutor constructor to accept schema_manager instead of individual schema contents.
    • Removed get_agent_card method (now handled by RizzchartsAgent).
    • Updated _prepare_session to use schema_manager.get_effective_catalog and schema_manager.load_examples.
    • Changed state keys from _A2UI_SCHEMA_KEY to _A2UI_CATALOG_KEY and added _A2UI_EXAMPLES_KEY.
  • samples/agent/adk/rizzcharts/component_catalog_builder.py
    • Removed the file, as its functionality was replaced by A2uiSchemaManager.
  • samples/agent/adk/rizzcharts/examples/rizzcharts_catalog/chart.json
    • Updated JSON Pointer paths in Chart component from relative (chart.title, chart.items) to absolute (/chart.title, /chart.items).
  • samples/agent/adk/rizzcharts/examples/rizzcharts_catalog/map.json
    • Updated JSON Pointer paths in GoogleMap component from relative (mapConfig.center, mapConfig.zoom, mapConfig.locations) to absolute (/mapConfig.center, /mapConfig.zoom, /mapConfig.locations).
  • samples/agent/adk/rizzcharts/examples/standard_catalog/chart.json
    • Updated JSON Pointer paths in Text components from relative (chart.title, label, value) to absolute (/chart.title, /label, /value).
  • samples/agent/adk/rizzcharts/examples/standard_catalog/map.json
    • Updated JSON Pointer paths in Text components from relative (name, description) to absolute (/name, /description).
  • samples/agent/adk/rizzcharts/rizzcharts_catalog_definition.json
    • Added catalogId field.
    • Updated $ref to use a full URL for the standard catalog definition.
  • specification/v0_8/eval/GEMINI.md
    • Updated documentation to reflect that components now have a component object instead of componentProperties.

Copy link
Collaborator

@jacobsimionato jacobsimionato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants