Skip to content

Conversation

@nan-yu
Copy link
Collaborator

@nan-yu nan-yu commented Jan 28, 2026

Description

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

Tested:

  • The contact angular client successfully connected to the contact_multiple_surfaces agent and rendered the response correctly.

Pre-launch Checklist

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

- Add a base InferenceStrategy class
- Add PackSpecsBuildHook to copy JSON schemas into the package during
  build time.
- Update pyproject.toml to include assets and configure the build hook.
- Implement A2uiSchemaManager for robust schema loading,  pruning, and
  prompt generation.
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 new a2ui-agent Python package with a centralized A2uiSchemaManager for handling A2UI schemas. This is a great architectural improvement, moving away from hardcoded schemas in the sample agents. The manager provides robust, multi-layered logic for loading schemas from package resources or the source repository, and includes functionality for bundling, pruning, and validating schemas. The sample agents (contact_lookup and contact_multiple_surfaces) are refactored to use this new manager, simplifying their code and making them more maintainable. The changes also include a Hatch build hook to package the schema files correctly and new tests for the added functionality.

I've found a couple of issues: one in a __main__ block in contact_lookup/prompt_builder.py that would cause a TypeError if run directly, and a logic error in contact_multiple_surfaces/agent.py where a check for a loaded schema was referencing a method instead of a property. I've provided suggestions to fix both. Overall, this is a well-executed and beneficial refactoring.


# Ensure schema was loaded
if self.use_ui and self.a2ui_schema_object is None:
if self.use_ui and self._schema_manager.bundle_schemas is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This check for a loaded schema is incorrect. self._schema_manager.bundle_schemas refers to the method itself, which will never be None. You should check the bundled_schema property instead, which holds the result of the schema bundling. This will ensure the error handling for a missing schema triggers correctly.

Suggested change
if self.use_ui and self._schema_manager.bundle_schemas is None:
if self.use_ui and self._schema_manager.bundled_schema is None:

Comment on lines 67 to 72
contact_prompt = A2uiSchemaManager("0.8", examples=CONTACT_UI_EXAMPLES).generate_system_prompt(
role_description=ROLE_DESCRIPTION,
workflow_description=WORKFLOW_DESCRIPTION,
ui_description=UI_DESCRIPTION,
include_examples=True,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The arguments in this block are incorrect and will cause a TypeError when running the script directly.

  1. The A2uiSchemaManager constructor does not accept an examples argument. The examples should be passed to the generate_system_prompt method instead.
  2. The generate_system_prompt method does not have an include_examples parameter; you should use the examples parameter.
Suggested change
contact_prompt = A2uiSchemaManager("0.8", examples=CONTACT_UI_EXAMPLES).generate_system_prompt(
role_description=ROLE_DESCRIPTION,
workflow_description=WORKFLOW_DESCRIPTION,
ui_description=UI_DESCRIPTION,
include_examples=True,
)
schema_manager = A2uiSchemaManager("0.8")
contact_prompt = schema_manager.generate_system_prompt(
role_description=ROLE_DESCRIPTION,
workflow_description=WORKFLOW_DESCRIPTION,
ui_description=UI_DESCRIPTION,
examples=CONTACT_UI_EXAMPLES,
)

@nan-yu nan-yu force-pushed the update-contact-multiple-surfaces-sample branch from aa19535 to a2cc041 Compare January 28, 2026 20:07
Tested:
- [x] The contact_lookup client successfully connected to the contact_lookup
agent and rendered the response correctly.
Introduces a `schema_modifiers` parameter to A2uiSchemaManager, allowing
custom callable hooks to transform schemas after loading. This enables
flexible schema customization, such as relaxing strict validation
constraints during testing.
It updates the sample to use the A2uiSchemaManager from the a2ui-agent
python SDK.

Tested:
- [x] The `contact` angular client successfully connected to the
  `contact_multiple_surfaces` agent and rendered the response correctly.
@nan-yu nan-yu force-pushed the update-contact-multiple-surfaces-sample branch from a2cc041 to 3eb5cf5 Compare January 28, 2026 20:55
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.

1 participant