Skip to content

API Reference parrot.outputs.a2ui.linked.materialize

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

parrot.outputs.a2ui.linked.materialize

View source

Pure helpers that turn a chat turn into a linked-widget origin (FEAT-757).

No I/O and no LLM: the origin is read from the turn's recorded tool invocations, the component from the envelope the caller already holds.

Attribute EXECUTE_TOOL

Attribute LINKED_TOOLS

Type: frozenset[str]

Class MaterializeWidgetResult

What materialize_widget returns (spec §2 Data Models).

Fields:

Field Type Default Description
status Literal['materialized', 'already_linked', 'snapshot_only', 'not_materializable']
reason str | None None
message str | None None
a2ui_envelope dict[str, Any] | None None
artifacts list[dict[str, Any]]
surface_id str | None None
pinned bool False
refreshable bool False
origin SlugOrigin | None None

Attribute NEUTRAL_TOOLS

Type: frozenset[str]

Class OriginOutcome

Result of :func:extract_slug_origin.

Fields:

Field Type Default Description
kind Literal['slug', 'already_linked', 'multi_source', 'none']
origin SlugOrigin | None None

Attribute REASON_BUILD_FAILED

Attribute REASON_MULTI_SOURCE_TURN

Attribute REASON_NO_ENVELOPE

Attribute REASON_NO_PUBLISH_SURFACE

Attribute REASON_NO_QUERYSOURCE_TOOLKIT

Attribute REASON_NO_SLUG_ORIGIN

Attribute REASON_PIN_FAILED

Attribute REASON_TURN_NOT_FOUND

Attribute REASON_UNSUPPORTED_COMPONENT

Attribute REQUEST_KEYS

Type: tuple[str, ...]

Attribute SUPPORTED_ROOTS

Type: frozenset[str]

Class SlugOrigin

The re-runnable data origin of a turn: one query slug plus its request.

Fields:

Field Type Default Description
slug str
tenant str | None None
request dict[str, Any]

Function component_from_envelope

Return the envelope's root component without its data binding, or None when it cannot be relinked.

The root is the component whose id is "root", else the first component. Returns None when the envelope has no components or the root's component is not in SUPPORTED_ROOTS.

component_from_envelope(envelope: Mapping[str, Any]) -> dict[str, Any] | None

Parameter Type Default Description
envelope Mapping[str, Any]

Returns: dict[str, Any] | None

Function extract_slug_origin

Decide a turn's data origin from its recorded tool invocations.

Rules, in order: ignore invocations whose status is not ToolStatus.COMPLETED; if any remaining invocation is outside NEUTRAL_TOOLS | LINKED_TOOLS | {EXECUTE_TOOL} -> none; if the last relevant invocation is in LINKED_TOOLS -> already_linked; collect qs_execute_slug origins — zero -> none, more than one distinct origin -> multi_source, otherwise slug with the last one.

extract_slug_origin(invocations: Sequence[ToolInvocation]) -> OriginOutcome

Parameter Type Default Description
invocations Sequence[ToolInvocation]

Returns: OriginOutcome

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