Remove notion of "custom catalogs" from agent SDK#705
Remove notion of "custom catalogs" from agent SDK#705nan-yu wants to merge 2 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This is a substantial but well-executed refactoring that removes the concept of "custom catalogs" needing runtime resolution, in favor of pre-bundled, self-contained catalogs. The changes centralize schema and validation logic, simplify the A2uiSchemaManager API, and improve the overall architecture. The test suite has been commendably updated to cover the new structure. I have one suggestion for a minor performance optimization.
a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/manager.py
Outdated
Show resolved
Hide resolved
aaf183d to
27bb573
Compare
|
/gemini summary |
Summary of ChangesThis pull request significantly refactors the A2UI SDK's approach to managing UI component catalogs. By eliminating the distinction of 'custom catalogs' and introducing a unified Highlights
Changelog
|
27bb573 to
7c31917
Compare
09f576f to
268c25f
Compare
This comment was marked as spam.
This comment was marked as spam.
a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/catalog.py
Outdated
Show resolved
Hide resolved
| examples_path: Optional[str] = None | ||
|
|
||
| @classmethod | ||
| def for_basic_catalog(cls, examples_path: Optional[str] = None) -> "CatalogConfig": |
There was a problem hiding this comment.
Can we move this to a top-level function in a different file, perhaps even a different folder, e.g. inference/basic_catalog or something?
That makes the conceptual separation clear, and avoids us accidentally sprinkling basic catalog assumptions into the core library. Ideally, it would be possible for us to publish basic catalog support as a completely separate library which depends on the core inference library.
There was a problem hiding this comment.
+1 on this, then we can run the basic catalog through the sdk like any other catalog
There was a problem hiding this comment.
This part is refactored with 2 class methods in the CatalogConfig:
- CatalogConfig.bundled(version, examples_path): load the bundled (basic) catalog with examples.
- CatalogConfig.from_path(name, catalog_path, examples_path): load the user catalog with examples.
I this way, the basic catalog can be loaded similar as other catalogs.
There was a problem hiding this comment.
Thanks for iterating!!
I'd still much prefer moving all references to the basic catalog to a separate basic_catalog folder and inverting the dependency structure, so that the basic catalog support depends on the core SDK. I can see how what you have is a super ergonomic way to access the basic catalog, but that's almost part of the problem, because it privileges the basic catalog above other catalogs. We have had a similar issue in the client SDKs and it's been very difficult to unwind, so that's why I'm so sensitive to it!
E.g.
BasicCatalog.getConfig(version, example_paths)or
CatalogConfig(BasicCatalog.provider(version), example_paths)I don't feel strongly about the exact API, as long as the basic catalog stuff is in a separate folder which depends on the core SDK, rather than the other way around.
Rationale:
- Avoid giving developers the idea that they should use the basic catalog if they are using A2UI
- Avoid us accidentally baking in more basic catalog assumptions. It's easy to spot when depend on it if it's in a different folder.
- Allow us to release basic catalog as a separate package if we want
- Provide an example for other catalog developers for how to expose their catalog programmatically in the Python SDK. E.g. if there is a Material Catalog, they might want to implement a package to expose it ergonomically in Python. If you provide a separate basic catalog implementation with programmatic APIs that build on top of the core APIs, they can trivially follow your example.
There was a problem hiding this comment.
Thanks for the explanation. That makes a lot of sense.
I've refactored the SDK to decouple basic catalog support from the core library:
- Moved the basic_catalog loading and instantiation to a separate
basic_catalogfolder. - Inverted the dependency to make
basic_catalogdepend on the core SDK. - Updated
pack_specs_hook.pyto generalized module loading. Basic catalog is currently bundled into the SDK the same way as other schemas (server-to-client and common-types), but it is modularized to be easily replaced with other approach if the basic catalog is moved outside of the specification directory.
a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/manager.py
Outdated
Show resolved
Hide resolved
a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/manager.py
Outdated
Show resolved
Hide resolved
268c25f to
9d789c4
Compare
9d789c4 to
6e6bd97
Compare
|
All comments are addressed. Ready for another round of review. Thanks @jacobsimionato @wrenj |
a2a_agents/python/a2ui_agent/src/a2ui/inference/schema/catalog_provider.py
Outdated
Show resolved
Hide resolved
c56ec04 to
873c1ab
Compare
The basic catalog maintained by the A2UI team has no difference from third-party catalogs. This PR removes the notion of custom catalogs. Each catalog provided at runtime should be independent and immutable. At build time, catalogs can refer to components from other catalogs. They need to be bundled into a free-standing one using the `tools/build_catalog/build_catalog.py` script. Fixes google#650
873c1ab to
32f7b35
Compare
32f7b35 to
302a100
Compare
Description
The basic catalog maintained by the A2UI team has no difference from third-party catalogs.
This PR removes the notion of custom catalogs. Each catalog provided at runtime should be independent and immutable. At build time, catalogs can refer to components from other catalogs. They need to be bundled into a
free-standing one using the
tools/build_catalog/build_catalog.pyscript.Fixes: #650
Pre-launch Checklist
If you need help, consider asking for advice on the discussion board.