Skip to content

API Reference parrot.outputs.a2ui.renderers

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

parrot.outputs.a2ui.renderers

View source

A2UI renderer registry and contract (Module 4, core side).

Core ships only the renderer contract — :class:RendererCapabilities, :class:AbstractA2UIRenderer, and the register/resolve functions. ALL concrete renderers live in ai-parrot-visualizations under the parrot.outputs.a2ui_renderers PEP 420 namespace, behind the a2ui / a2ui-pdf extras (spec G8).

Resolution copies the EmbeddingRegistry dispatch shape: look up the registry first; if the name is unknown, importlib.import_module the satellite module (which self-registers on import), then re-read the registry. A missing satellite raises an actionable :class:ImportError naming the pip extra.

Class AbstractA2UIRenderer

Abstract base for every A2UI renderer (spec §2 New Public Interfaces).

Subclasses MUST declare a :class:RendererCapabilities class attribute capabilities and implement the async :meth:render.

Attributes:

Attribute Type Description
capabilities RendererCapabilities

Method AbstractA2UIRenderer.render

Render an envelope to a RenderedArtifact (baked) or a string.

render(envelope: CreateSurface, *, bake: bool = True) -> 'Any | str'

Parameter Type Default Description
envelope CreateSurface The validated createSurface envelope to render.
bake bool True When True, resolve all data-model bindings and produce a self-contained RenderedArtifact (Module 6). When False, a live/string representation may be returned.

Returns: 'Any | str' — A RenderedArtifact (from Module 6) or a string, per the renderer.

Class RendererCapabilities

Declared capabilities of an A2UI renderer (spec §2 Data Models).

Fields:

Field Type Default Description
interactive bool Whether the surface supports live interaction.
supports_actions bool Whether the renderer can dispatch component actions.
supports_updates bool Whether the renderer supports incremental updates.
output str The output mime type (e.g. "text/html", "application/pdf") or the literal "live" for interactive live surfaces.
supported_catalog_ids list[str] Catalog ids this renderer can resolve components against (FEAT-470 TASK-2543). Defaults to the two catalogs every renderer in this codebase currently understands (the official Basic Catalog + the Parrot custom catalog).
supported_components set[str] Component names this renderer natively renders. A component name absent from this set degrades (spec: "nunca excepción silenciosa") — see :mod:parrot.outputs.a2ui.renderers.degrade.

Function get_a2ui_renderer

Resolve a renderer class by name, importing its satellite module if needed.

get_a2ui_renderer(name: str) -> type[AbstractA2UIRenderer]

Parameter Type Default Description
name str The renderer name (e.g. "ssr_html", "pdf").

Returns: type[AbstractA2UIRenderer] — The registered renderer class.

Raises:

  • ImportError — If the satellite module cannot be imported (message names the required pip extra), or if the module imported but did not register.

Function register_a2ui_renderer

Register an A2UI renderer class under name.

register_a2ui_renderer(name: str, capabilities: RendererCapabilities) -> Callable[[type[AbstractA2UIRenderer]], type[AbstractA2UIRenderer]]

Parameter Type Default Description
name str The renderer name used with :func:get_a2ui_renderer.
capabilities RendererCapabilities The renderer's declared capabilities; also assigned to the class as its capabilities attribute.

Returns: Callable[[type[AbstractA2UIRenderer]], type[AbstractA2UIRenderer]] — The class decorator.

Raises:

  • TypeError — If capabilities is not a :class:RendererCapabilities.

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