Skip to content

API Reference parrot.outputs.a2ui.runtime.dispatch

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

parrot.outputs.a2ui.runtime.dispatch

View source

A2UIRuntime — the A2UI Agent Functions dispatch core (spec §3 Module 2).

Pure protocol: takes a deserialized renderer->agent envelope plus an :class:~parrot.outputs.a2ui.runtime.models.A2UICallContext and returns a :class:~parrot.outputs.a2ui.runtime.models.DispatchResult of already- serialized agent->renderer envelopes. It knows nothing about HTTP, A2A, bots, or tools — everything it needs arrives through the three injected Protocols declared in :mod:parrot.outputs.a2ui.runtime (G8 one-way import rule: no module-level parrot.bots/parrot.clients/ parrot.tools/parrot.memory import; :data:typing.TYPE_CHECKING only).

Class A2UIRuntime

Dispatches A2UI v1.0 renderer->agent envelopes (spec §2, §3 Module 2).

Parameter Type Default Description
executor FunctionExecutor Adapter over the agent's tool registry (TASK-2570's ToolManagerExecutor in production; a fake in tests).
surfaces SurfaceStateStore Adapter storing the last dataModel per surface.
pending PendingCallRegistry Adapter tracking agent->renderer calls awaiting correlation.
catalog_id str DEFAULT_CATALOG_ID The default catalog id used when no surface-specific one is known (e.g. for call_renderer()'s own outbound calls).

Method A2UIRuntime.dispatch

Dispatch a single renderer->agent envelope.

dispatch(envelope: dict[str, Any] | A2UIRendererMessage, ctx: A2UICallContext) -> DispatchResult

Parameter Type Default Description
envelope dict[str, Any] | A2UIRendererMessage A raw JSON dict (goes through :func:~parrot.outputs.a2ui.serialization.deserialize) or an already-validated :class:A2UIRendererMessage.
ctx A2UICallContext The call context built by the transport.

Returns: DispatchResult — class:DispatchResult carrying the already-serialized agent->renderer envelope(s) to return, and any structured turn/ surface-state side effect.

Method A2UIRuntime.call_renderer

Register a pending agent->renderer call and build its envelope.

call_renderer(session_id: str, surface_id: str, call: str, args: dict[str, Any], *, catalog_id: str | None = None) -> tuple[str, dict[str, Any]]

Parameter Type Default Description
session_id str The session this call belongs to.
surface_id str The surface this call targets.
call str The renderer function name to invoke.
args dict[str, Any] Arguments for the renderer function.
catalog_id str | None None The catalog the function belongs to. Defaults to this runtime's own catalog_id — the official schema requires callFunction.catalogId on callRendererFunction even though the shared :class:FunctionCall model does not.

Returns: tuple[str, dict[str, Any]] — A tuple of (function_call_id, serialized_envelope).

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