Skip to content

docs(integrations): fix broken a2ui-agent-sdk imports in A2UI guide - #2180

Open
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-a2ui-sdk-imports
Open

docs(integrations): fix broken a2ui-agent-sdk imports in A2UI guide#2180
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-a2ui-sdk-imports

Conversation

@rootkiller6788

Copy link
Copy Markdown

Problem

Every Python code block on the A2UI integration page fails against the released a2ui-agent-sdk 0.5.0:

  • from a2ui.core.schema.manager import A2uiSchemaManager -> ModuleNotFoundError: No module named 'a2ui.core.schema.manager' (there is no a2ui.core namespace in a2ui-agent-sdk; A2uiSchemaManager lives in a2ui.schema.manager, and the recommended class is DirectJsonFormat in a2ui.inference_formats.direct_json)
  • from a2ui.core.parser.parser import parse_response -> ModuleNotFoundError: No module named 'a2ui.core.parser' (real path: a2ui.parser.parser)
  • from a2ui.a2a import parse_response_to_parts / from a2ui.a2a import create_a2ui_part / from a2ui.a2a import get_a2ui_agent_extension -> ImportError (the a2ui.a2a package has no __init__.py; these symbols live in a2ui.a2a.parts and a2ui.a2a.extension)
  • DirectJsonFormat(...), BasicCatalog.get_config(...), and get_a2ui_agent_extension(...) were called without the required version argument -> TypeError: missing 1 required positional argument: 'version'

Fix

  • Pointed every import at the real module paths (a2ui.inference_formats.direct_json, a2ui.parser.parser, a2ui.a2a.parts, a2ui.a2a.extension, a2ui.schema.catalog, a2ui.schema.constants).
  • Switched the schema manager to the recommended, non-deprecated DirectJsonFormat class (A2uiSchemaManager in a2ui.schema.manager is a deprecated compatibility shim).
  • Added version=VERSION_0_9 (imported from a2ui.schema.constants) to DirectJsonFormat, BasicCatalog.get_config, and get_a2ui_agent_extension.

Verification

Installed a2ui-agent-sdk==0.5.0 (with its declared deps a2ui-core and a2a-sdk) in a clean virtualenv and executed every code block from the updated page end-to-end, including generate_system_prompt, parse_response + selected_catalog.validator.validate, parse_response_to_parts, create_a2ui_part, and get_a2ui_agent_extension. All blocks pass.

Fixes the import reported in #2131 and the additional broken imports found on the same page.

The A2UI page imported modules that do not exist in the released
a2ui-agent-sdk 0.5.0: a2ui.core.schema.manager and a2ui.core.parser.parser
raise ModuleNotFoundError, and importing directly from the a2ui.a2a
namespace package raises ImportError.

Point all code blocks at the real module locations
(a2ui.inference_formats.direct_json, a2ui.parser.parser, a2ui.a2a.parts,
a2ui.a2a.extension) and switch to the recommended, non-deprecated
DirectJsonFormat class. Also pass the now-required version argument
(VERSION_0_9 from a2ui.schema.constants) to DirectJsonFormat,
BasicCatalog.get_config, and get_a2ui_agent_extension, which otherwise
raise TypeError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant