Skip to content

API Reference parrot.outputs.a2ui.catalog.export

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.outputs.a2ui.catalog.export

View source

export_catalog_definition — the parrot catalog's catalog_definition.json (Module 5, FEAT-470 TASK-2540); export_functions/agent_capabilities (FEAT-469 TASK-2571, spec §3 Module 4, goal G4).

Produces a document valid against the official catalog_definition.json schema (vendored, TASK-2534), describing the Parrot catalog (:data:~parrot.outputs.a2ui.catalog.base.DEFAULT_CATALOG_ID) for consumption by any A2UI-aware tool (LLM system prompt, external renderer catalog resolution, ...). Basic Catalog components/functions are included by $ref (spec G2) rather than duplicated, so the Parrot catalog stays a thin overlay.

export_functions() adds a THIRD source to the functions map: the agent's own tools (a FunctionExecutor, spec §2/G1). It never imports parrot.tools/parrot.memory — it only depends on the FunctionExecutor protocol's return type (:class:~parrot.outputs.a2ui.catalog.base.FunctionDefinition), preserving G8.

Function agent_capabilities

Build the agent_capabilities document (spec §2, G5).

agent_capabilities(catalog_ids: list[str]) -> dict[str, Any]

Parameter Type Default Description
catalog_ids list[str] The catalog ids this agent supports (e.g. [DEFAULT_CATALOG_ID, BASIC_CATALOG_ID]).

Returns: dict[str, Any] — A dict valid against the vendored agent_capabilities.json schema. acceptsInlineCatalogs is hard False — spec §1 Non-Goals excludes the renderer's inlineCatalogs function.

Function export_catalog_definition

Build the catalog definition document for catalog_id (spec §2).

export_catalog_definition(*, catalog_id: str = DEFAULT_CATALOG_ID, include_basic: bool = True, executor: FunctionExecutor | None = None) -> dict[str, Any]

Parameter Type Default Description
catalog_id str DEFAULT_CATALOG_ID The catalog to export. Defaults to the Parrot catalog.
include_basic bool True If True (default), every official Basic Catalog component/function is included as a $ref to catalog.json#/components/<Name>/#/functions/<Name> — so a bare component name ("Text", "Button", ...) resolves under the Parrot catalog too (spec G2).
executor FunctionExecutor | None None Optional FunctionExecutor (spec §2/G4, FEAT-469). When given, :func:export_functions is merged into functions — the agent's own tools become part of the exported document. Any collision with an existing (Basic or parrot-catalog) function name is a hard error.

Returns: dict[str, Any] — A dict valid against the vendored catalog_definition.json schema (protocolVersion, catalogId, instructions, components, functions).

Raises:

  • ValueError — If executor is given and a tool function name collides with an existing catalog function.

Function export_functions

Export executor's tools as A2UI functions (spec §2/G4).

Names are sanitized to UAX #31 identifiers when needed (a warning is logged per sanitized name); the caller must NOT assume the returned keys equal FunctionDefinition.name verbatim. A tool whose (possibly sanitized) name collides with a Basic Catalog function, an existing parrot-catalog function, or another tool (post-sanitization) is a hard error — a silent overwrite would let a renderer invoke the wrong function.

Tools already excluded from executor.list_functions() (i.e. a2ui_hidden=True, TASK-2570) never reach this function at all.

export_functions(executor: FunctionExecutor) -> dict[str, dict[str, Any]]

Parameter Type Default Description
executor FunctionExecutor The agent's FunctionExecutor (ToolManagerExecutor in production).

Returns: dict[str, dict[str, Any]] — {name: {..args schema.., "returnType", "allowedCallers", "requiresUserActivation"}} — the same flat shape func:export_catalog_definition already uses for catalog-registered functions (catalog_definition.json#/$defs/FunctionDefinition has unevaluatedProperties: false, so the args schema keys and the three metadata keys must sit at the same level).

Raises:

  • ValueError — On any name collision (Basic Catalog, parrot catalog, or another tool after sanitization).

Function write_catalog_definition

Write :func:export_catalog_definition's output to path as JSON.

write_catalog_definition(path: Path, *, catalog_id: str = DEFAULT_CATALOG_ID) -> None

Parameter Type Default Description
path Path The destination file path.
catalog_id str DEFAULT_CATALOG_ID The catalog to export. Defaults to the Parrot catalog (FEAT-529 Module 0 — was previously hardcoded to the default; now forwarded so a caller can write the viz-core document too).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally