The A2UI extension of the A2A protocol: extension URIs and their negotiation, and A2UI messages carried in A2A parts.
Parts are the JSON objects of A2A's JSON-RPC binding:
%{"kind" => "text", "text" => "Here is your form."}
%{"kind" => "data", "data" => message, "metadata" => %{"mimeType" => "application/a2ui+json"}}Each A2UI message travels in a data part of its own, the shape the
reference SDKs, sample agents and clients exchange. a2ui_messages/1
also reads a data part whose data is a list of messages, the shape
the extension specification describes.
A2UIAgent.A2A.Server answers A2A requests with these helpers, and
A2UIAgent.A2A.Plug serves them over HTTP.
Summary
Functions
The A2UI messages that parts carry, in order. A data part may hold one
message or a list of them.
A data part holding data (an A2UI message, or a list of them), marked
with the MIME type of version (see mime_type/1).
Whether part is a data part marked as A2UI, with either MIME type in
its metadata.
Activates the newest A2UI extension that is both requested and
advertised: {:ok, uri, version}, or :none.
The A2UI extension URIs an agent card advertises.
The A2UI entry for an agent card's capabilities.extensions.
Reads the next chunk of a streamed response with parser and returns
the A2A parts it completes, with the parser to read the next chunk.
The URI every A2UI extension URI starts with.
The extension URI of a version, for example
"https://a2ui.org/a2a-extension/a2ui/v1.0" for "1.0" or "v1.0".
The version an A2UI extension URI names, or nil for any other URI.
The MIME type that marks a data part as A2UI.
The MIME type for parts of a protocol version: "application/a2ui+json"
from v0.9.1 on, the older "application/json+a2ui" before it and when
the version is unknown (nil).
The A2UI extension URIs among values: extension URIs, or
comma-separated lists of them as the X-A2A-Extensions header carries.
Parses a complete model response with parser (a format parser, see
A2UIAgent.RequestProcessor.parser/1) into A2A parts.
The newest extension URI that is both requested and advertised, or
nil. Versions compare as SemVer, so v1.10.0 is newer than v1.2.0.
A text part.
The A2A parts for parsed response parts ({:text, text} and
{:a2ui, messages}): a text part for each non-empty text and a data
part for each message.
Types
Functions
The A2UI messages that parts carry, in order. A data part may hold one
message or a list of them.
The MIME type may also be a property of the part itself rather than of its metadata, as some sample clients send it.
A data part holding data (an A2UI message, or a list of them), marked
with the MIME type of version (see mime_type/1).
Whether part is a data part marked as A2UI, with either MIME type in
its metadata.
Activates the newest A2UI extension that is both requested and
advertised: {:ok, uri, version}, or :none.
The A2UI extension URIs an agent card advertises.
The A2UI entry for an agent card's capabilities.extensions.
Options: :accepts_inline_catalogs (default false) and
:supported_catalog_ids (default []). Each appears in params only
when it differs from its default, and params only when it is not
empty.
@spec chunk_parts(struct(), String.t(), String.t() | nil) :: {:ok, struct(), [part()]} | {:error, A2UICore.Error.t()}
Reads the next chunk of a streamed response with parser and returns
the A2A parts it completes, with the parser to read the next chunk.
@spec extension_base_uri() :: String.t()
The URI every A2UI extension URI starts with.
The extension URI of a version, for example
"https://a2ui.org/a2a-extension/a2ui/v1.0" for "1.0" or "v1.0".
The version an A2UI extension URI names, or nil for any other URI.
@spec mime_type() :: String.t()
The MIME type that marks a data part as A2UI.
The MIME type for parts of a protocol version: "application/a2ui+json"
from v0.9.1 on, the older "application/json+a2ui" before it and when
the version is unknown (nil).
The A2UI extension URIs among values: extension URIs, or
comma-separated lists of them as the X-A2A-Extensions header carries.
Parses a complete model response with parser (a format parser, see
A2UIAgent.RequestProcessor.parser/1) into A2A parts.
A response that does not parse is logged and yields no parts. Option:
:fallback_text — the text part to answer with when there are no
parts, for example the response itself.
The newest extension URI that is both requested and advertised, or
nil. Versions compare as SemVer, so v1.10.0 is newer than v1.2.0.
A text part.
The A2A parts for parsed response parts ({:text, text} and
{:a2ui, messages}): a text part for each non-empty text and a data
part for each message.