Expand description
agent86UI’s protocol layer: Google’s A2UI 1.0 for Rust.
A2UI lets an agent describe UI as declarative JSON that a renderer draws with its own widgets, from a catalog of components and functions it trusts. This crate is the agent’s side of it, with no dependency on the rest of agent86:
Catalog: a catalog loaded and checked against the specification’s rules, andCatalog::basic, the specification’s basic catalog;AgentMessageandRendererMessage: the messages, typed;Validator: checks what an agent’s model wrote, batch by batch, against the schemas and the rules they cannot express (surfaces,root, child references, composition, function boundaries), with the specification’s error codes and paths, so the problems can go back to the model;runtime: the headless surface runtime a renderer builds on: surfaces’ components and data models, every binding, call, template, and check resolved for drawing (runtime::Runtime::tree), user input written back, and actions dispatched, with the basic catalog’s functions (formatting inen-US, the regex dialect and its safety rules) implemented;SchemaSet: the envelope schemas compiled against a catalog, for the schema half of validation alone;is_identifier: the specification’s naming rule.
The JSON Schemas and the basic catalog are vendored from the specification
(spec/, Apache-2.0, upstream commit recorded in spec/UPSTREAM.md) and
served from memory: nothing is ever fetched. The tests replay the
specification’s schema cases and its shared conformance suites for the
runtime (conformance/core/ upstream).
agent86UI is agent86’s implementation of A2UI; A2UI is Google’s protocol, and this crate is not affiliated with or endorsed by Google.
Modules§
- runtime
- The headless surface runtime: what a renderer does, without drawing.
Structs§
- Action
action: a user interaction with a component whose action is an event.- Agent
Message - A message from the agent to the renderer.
- Call
Agent Function callAgentFunction.- Call
Renderer Function callRendererFunction.- Catalog
- A loaded, checked catalog.
- Check
Rule - One
@checksrule: a condition (a binding or a function call) and the message to show when it fails. - Compile
Error - Why a schema could not be compiled: a catalog that refers outside the documents served, or that is not a valid schema.
- Component
- One component on a surface.
idandcomponentare the protocol’s; the@-prefixed fields are its envelope mixins; everything else is the catalog’s, kept as JSON inComponent::properties. - Component
Def - What validation needs to know about one component type.
- Create
Surface createSurface.- Delete
Surface deleteSurface.- Error
Body - A function response’s
error. - Function
Call - A call to a catalog function, as it appears in bindings, checks, actions, and the function-call messages.
- Function
Def - What validation needs to know about one function.
- Function
Response agentFunctionResponseandrendererFunctionResponse: a value or an error.- Problem
- One problem found in a batch.
- Renderer
Error - A renderer’s
errormessage. - Renderer
Message - A message from the renderer to the agent.
- Report
- What
Validator::checkfound. - Rules
- How strictly a surface’s component tree must be complete once a batch is
applied: the reference SDKs’
ValidationConfig, without its version and message filters. - Schema
Error - One failure from a schema check: where in the checked value, and why.
- Schema
Set - The message schemas compiled against one catalog.
- Update
Components updateComponents.- Update
Data Model updateDataModel.- Validator
- The agent’s view of a renderer: the catalogs it supports and the surfaces sent to it so far.
Enums§
- Agent
Message Kind - The kinds of agent-to-renderer message.
- Callers
- Who may call a function (
allowedCallers). - Catalog
Error - Why a catalog was refused when loaded.
- Child
Ref - How a component property refers to other components, read from its schema’s
$ref, which is how the specification says validators find structural links (“Validator compliance when defining catalogs”). - Code
- The specification’s error codes that agent-side validation reports.
- Renderer
Message Kind - The kinds of renderer-to-agent message.
Constants§
- ALLOWED_
EXTERNAL_ REF_ TARGETS - The schemas in
common_types.jsona catalog’s external$refmay target (the specification’s catalog schema rule 3, “Restricted$refTargets”). - BASIC_
CATALOG_ ID - The basic catalog’s id, as the specification publishes it.
- MAX_
CALL_ DEPTH - How deep function calls may nest, as in the reference SDKs.
- MAX_
DEPTH - How deep values may nest in a message, and components below
root, as in the reference SDKs. - PROTOCOL_
VERSION - The A2UI protocol version this crate implements, as messages carry it in
their
versionfield. - SPEC_
BASE - The base URI the 1.0 schemas’
$ids share.
Functions§
- check_
agent_ capabilities - Check an agent capabilities object (
{"1.0": {...}}). - check_
catalog_ definition - Check a catalog document against
catalog_definition.json. - check_
renderer_ capabilities - Check a renderer capabilities object (
{"1.0": {"supportedCatalogIds": [...]}}). - check_
renderer_ data_ model - Check a renderer data model message (
{"version": "1.0", "surfaces": {...}}). - is_
identifier - Whether
nameis a UAX #31 identifier as A2UI defines one: anXID_Startcharacter or_, thenXID_Continuecharacters, with noPattern_SyntaxorPattern_White_Spacecharacter other than_. (XID_Continuealready excludes both; the second check keeps the rule explicit, as the specification states it.) A leading digit is refused because digits are notXID_Start.