Repository navigation
a2ui-agent-sdk 0.8.0
·
262 commits
to main
since this release
- BREAKING: Package dependency updated to require
a2ui-core>=0.3.0,<0.4.0. - BREAKING:
remove_strict_validationand theschema_modifiers
parameter ofCatalogConfig.to_catalogare removed. Catalog schemas are
parsed as published, withadditionalPropertiesandunevaluatedProperties
kept, andCatalogConfigtransformersare the way to shape a catalog. To
migrate, dropschema_modifiers=[remove_strict_validation]from
to_catalogcalls, and make examples and generated payloads match the
catalog schema. - From v1.0,
DirectJsonStreamParseryields a component only once its JSON
object closes, instead of healing and yielding it while it streams. A v1.0
component may name its owncatalogIdafter its type and properties, and a
component yielded early was checked against its surface's catalog. Progressive
keys still heal data model values. v0.8 and v0.9 streaming is unchanged. - BREAKING:
DirectJsonParser,DirectJsonStreamParserand
A2uiPartConvertertake a sequence of catalogs instead of one catalog, and
expose them ascatalogs. A parser holds every catalog the renderer supports
and checks each surface against the catalog that its start message names, or
a component against the catalog itscatalogIdnames.DirectJsonFormat
passes all of its catalogs to its parsers, andcreate_stream_parser()uses
the format's catalogs without taking acatalogparameter (#2967). To
migrate, wrap a single catalog in a list:DirectJsonParser([catalog]). - A
DirectJsonStreamParsersurface can be created again after
deleteSurface. Before, the parser kept the surface ID as deleted and
dropped every later message for it. v0.9 and later clear it on
createSurface; v0.8, which has nocreateSurface, clears it on the next
message for the surface that isn'tdeleteSurface(#2967). validate_payloadtakessurface_catalog_ids, the catalogs that earlier
payloads created surfaces with, and checks updates to those surfaces against
them, and typespayloadasAgentToRendererMessagePayload(#2967).- Rename
DirectJsonStreamParserV08toDirectJsonStreamParserV08Legacy
(streaming_v08_legacy.py) andDirectJsonStreamParserV09to
DirectJsonStreamParserModern(streaming_modern.py), fix the v0.9.1 and
v1.0 streaming parsers applying the v0.8 path heuristic to data bindings, and
passcallRendererFunctionandagentFunctionResponsemessages through for
v1.0 (#2967). - BREAKING:
A2uiCatalogis removed. Inference formats, prompt
generators, parsers, skills, macros and the ADK toolset take and return the
a2ui.corecatalog itself, typedCatalogApi. The protocol schemas that
A2uiCatalogcarried come from the inference format or froma2ui.core
(#2966). To migrate:A2uiCatalog.from_config(config, version)becomes
config.to_catalog(protocol_version=version), and
A2uiCatalog.from_json_file(path)becomes
CatalogConfig.from_path(name, path).to_catalog().core_catalogis the catalog itself,versionbecomes
protocol_version, andnamestays onCatalogConfig.catalog_schemais the schema that the core catalog generates. Unlike
the file, it refers to common types locally, has the catalog's own
definitions inlined, and has no$id,titleordescription.s2c_schemaandcommon_types_schemaare no longer on the catalog or
the format. The SDK uses the published schemas for the catalog's
protocol version, whichget_agent_to_renderer_schema_mapand
get_common_types_schema_mapina2ui.corereturn.with_pruning(allowed_components, allowed_messages)becomes
ComponentPruningTransformer(allowed_components), applied with
transformor passed toCatalogConfigastransformers, and
schema_to_prompt([catalog], allowed_messages=...).render_as_llm_instructions()becomesschema_to_prompt([catalog])from
a2ui.inference_formats.direct_json.load_examples(path, validate)becomes
load_examples([catalog], path, validate)froma2ui.schema.validate_components(payload), which returned a list of errors, becomes
validate_payload([catalog], payload)froma2ui.utils, which raises
A2uiValidationError.validatorbecomesPayloadValidator(catalog)froma2ui.core.
- Add
a2ui.catalog_transformerswithCatalogTransformer,
ComponentPruningTransformerandFunctionPruningTransformer.
CatalogConfigtakestransformers, whichto_catalogapplies to the
loaded catalog (#2966). - Add
a2ui.utils.resolve_catalogsreturns the catalogs that are active
for the capabilities a renderer sent.prune_messages_schemaand
prune_common_types_schemareduce the protocol schemas.validate_payload
checks a payload the way a renderer holding the catalogs would, including
theversionthat each message states, and raisesA2uiValidationError
(#2966). - Add
schema_to_prompttoa2ui.inference_formats.direct_json, which
returns the prompt text for a sequence of catalogs of one protocol version,
together with the agent-to-renderer schema and the common types
they reference, shown once, and
DirectJsonFormat.create_stream_parser, which builds a stream parser with
the format's progressive keys (#2966). - The Direct JSON stream parser checks each message with
validate_payload,
which runs it through aMessageProcessorholding the catalog, instead of
against the JSON agent-to-renderer schema. It no longer takes or loads the
protocol schemas, and its errors are the core's, prefixed with
Validation failed:(#2966). - BREAKING:
DirectJsonFormat(catalogs, *, examples_path, progressive_keys)
takes the catalogs that are already resolved for a renderer and no longer
selects or changes them (#2966). To migrate:- The protocol version comes from the catalogs, which must share one. Pass
the version toCatalogConfig.to_cataloginstead ofversion.
schema_modifiersis removed; the catalog, agent-to-renderer and common
types schemas are used as published. get_selected_catalog(client_ui_capabilities)is removed. Call
resolve_catalogs(configs, capabilities, accepts_inline_catalogs)from
a2ui.utilsand build the format from the result, once per renderer.
Inline catalogs become catalogs of their own instead of being merged into
the selected one, and ones the agent doesn't accept are dropped instead
of raising.resolve_catalogsreads capabilities keyed by protocol version, such as
{"v0.9": {"supportedCatalogIds": [...]}}. A flat capabilities object, a
bareV09Capabilitiesmodel or an empty mapping raises
A2uiValidationErrorinstead of falling back to the default catalog. No
capabilities at all activates every registered catalog instead of the
first one, and an emptysupportedCatalogIdswithout inline catalogs
raisesA2uiCatalogError.accepts_inline_catalogsandexperimentsare removed from the format.
The agent card still takesaccepts_inline_catalogs.- The prompt describes every catalog of the format, and
prompt_generator.generateraisesA2uiCatalogErrorif given
client_ui_capabilities. Itsallowed_componentsand
allowed_messagesare deprecated and ignored. Prune components before
building the format withComponentPruningTransformer, for example passed
toCatalogConfigastransformers, and restrict messages with
schema_to_prompt(catalogs, allowed_messages=...). examples_pathreplacesCatalogConfig.examples_pathfor the prompt's
examples, which are validated against every catalog of the format._supported_catalogsandsupported_catalog_idsbecome thecatalogs
property, and theload_examplesmethod becomes
load_examples(catalogs, path, validate)froma2ui.schema.
- The protocol version comes from the catalogs, which must share one. Pass
- BREAKING: The deprecated
a2ui.schema.manager.A2uiSchemaManageris
removed. UseDirectJsonFormat(#2966). - BREAKING:
DirectJsonParser.compile, and soparse_response, checks a
final payload withvalidate_payloadagainst the parser's catalog, and
raisesA2uiValidationErrorfor one that fails. Before, it checked nothing
by default.DirectJsonParserno longer takes avalidator.A2uiPartConverteruses this parser, so it
now falls back for invalid A2UI (#2966). - BREAKING:
CatalogConfig.custom_cuttable_keysis removed. The string
keys that the Direct JSON stream parser heals are now a format option,
DirectJsonFormat(progressive_keys=...), which replaces the defaults. The
defaults are exported asDEFAULT_PROGRESSIVE_KEYSfrom
a2ui.inference_formats.direct_json, and an empty set turns healing off
(#2966). - BREAKING: Allowlists are read literally. An empty
allowed_components
now keeps no components and an emptyallowed_messageskeeps no messages;
before, an empty list kept everything.Nonestill keeps everything
(#2966). SendA2uiToClientToolsetnow returns a tool error, with the validation
message, for a payload that fails validation. Before, it ignored the errors
thatvalidate_componentsreturned (#2966).- The schema helpers of the Express, Elemental and Atom formats inline a
catalog's local references withinline_local_refsfroma2ui.core, as
Catalog.from_jsondoes, so a catalog built from models, such as
BasicCatalog("0.9"), keeps properties that it defines in its own$defs,
such asweight(#2966). - BREAKING: The SDK no longer bundles specification JSON files.
load_from_bundled_resourceandA2UI_ASSET_PACKAGEare removed; get the
agent-to-renderer schema fromget_agent_to_renderer_schema_mapin
a2ui.coreinstead.PROTOCOL_VERSION_MAP, its aliasSPEC_VERSION_MAP,
SERVER_TO_CLIENT_SCHEMA_KEYandCOMMON_TYPES_SCHEMA_KEY, which described
the specification files, are removed too. TheVERSION_*constants still
name the supported versions (#2964). - Building or installing the SDK from source no longer regenerates the Express
parser, so it no longer needs Java. The generated parser stays committed; after
changingExpress.g4, runscripts/generate_express_parser.py(#2964). - Catalogs that inference formats take or return are typed
CatalogApifroma2ui.coreinstead ofCatalog[Any, Any]. - Add A2UI Macros API under
a2ui.transformers.macros(@macrodecorator andMacroExpander), enabling authoring of reusable, high-level composite components using fluent Python builder classes that lower into primitive A2UI component subtrees (transform_to_transport) and synthesize inference catalog schemas (transform_to_inference_catalog,to_catalog) (#2519). - BREAKING: The common types schema is no longer bundled as an asset.
DirectJsonFormattakes it from a2ui-core's generated schema
(a2ui.schema.utils.load_common_types_schema), the same definitions that
payload validation uses. - Streaming validation errors quote the schema's own pattern (for example
\p{XID_Start}) instead of its expansion for Python'sremodule. - BREAKING:
a2ui.basic_catalog(BasicCatalog,BundledCatalogProvider,
andBASIC_CATALOG_NAME) is removed, and the basic catalog JSON files are no
longer bundled. UseBasicCatalogfroma2ui.core.basic_cataloginstead:
BasicCatalog.get_config(version)becomes
CatalogConfig.from_catalog("basic", BasicCatalog(version)). - Add
CatalogConfig.from_catalogandInMemoryCatalogProvider(exported from
a2ui.schema) to configure a catalog from ana2ui.corecatalog instance.
Published to PyPI: a2ui-agent-sdk 0.8.0
pip install a2ui-agent-sdk==0.8.0