Front-end compositions with A2UI and AgentSpaces
An agent draws a page for people by writing A2UI envelopes into a space its group shares. Any member that renders draws the page and writes each click back. This guide shows how the AgentCard and the AppCard declare a page, how to compose one from the open widget library, how it travels, and where AgentSpaces stands in the A2UI ecosystem.
Why A2UI in a fleet
This guide is for engineers who want their agents to show people something and hear back. You might want a desk that lists claims, a chat about shared files, or a dashboard of charts. A2UI is an open protocol for exactly that, and AgentSpaces carries it through a group of peers. The how and the why are in the appendix.
The idea in four lines:
- An agent describes a page as data: a list of components, a data model, and the actions a person may take. Nothing executable crosses the wire.
- The agent writes that data into a space of its group as ordinary entries, one A2UI envelope per entry.
- Any member that renders reads the entries in order and draws the page with its own widgets.
- A person's click comes back as an entry the agent reads, so the agent answers by writing more envelopes.
AgentSpaces adds three things to plain A2UI:
- Cards. An agent's AgentCard says which components it can show. An AppCard names the application people use and how it travels. Every member finds both by discovery.
- A widget library. Two open catalogs,
agentspaces-viz(charts, tables, maps, the frame of a page) andagentspaces-widgets(a chat, a file tree, a file preview), with builders in Java, TypeScript, and Python and a React renderer. - A group to travel in. The envelopes are leased entries that every member replicates, so a renderer that joins late still draws the whole page.
A few words first
From A2UI:
- A surface is one page an agent draws, named by a surface id.
- An envelope is one message about a surface:
createSurface,updateComponents,updateDataModel, ordeleteSurface, each with aversion,1.0here. - A component is one part of a page, such as a
Column, aText, or aButton. Components refer to each other by id, as a flat list. - A catalog lists the components a renderer can draw, with the properties of each. A2UI's own is the basic catalog.
- The data model holds the values components show. A component binds to a path with
{"@path": "/status"}. - A component's own properties sit beside a few keys A2UI keeps for itself:
id,component, and the@-prefixed@catalogId,@accessibility,@metadata, and@checks. - An action is what a person's click sends back:
name,surfaceId,sourceComponentId,timestamp, andcontext. - A renderer draws envelopes with the widgets of one framework, such as React or Flutter.
From AgentSpaces:
- A group is the set of peers that work together. A space is a named, replicated store of typed entries inside a group, and every entry has a lease that says how long it lives.
- A card is a signed, leased advertisement. The four kinds are the AgentCard, the AssetCard, the ModelCard, and the AppCard.
- A pen is the
Surfaceshelper ofagentspaces-a2ui: each call writes one envelope as aSurfaceentry. - The views space is the space a group's pages travel in. Its name is
viewsby convention.
The picture
- The agent's peer holds the agent and a pen. The agent's card and the app's card go into every member's ad cache.
- The group's
viewsspace holds the envelopes in order, numbered per page, and the actions people take. - A renderer is any member that reads
views. It can be the open React renderer, which draws both open catalogs, or a third-party A2UI renderer, which draws a page written on the basic catalog.
What works today, and what does not
| Part | State in 0.7.0 |
|---|---|
| A2UI 1.0 envelopes, in both directions | supported: the pen writes them, SurfaceAction carries the action back |
| The basic catalog of 1.0 | supported: builders for Text, Column, Row, Card, Button, Divider, and bound text |
Calls from a page to the agent (callAgentFunction) | supported: Surfaces.functionCall and functionButton write them, and the agent answers with a FunctionResponse |
agentspaces-viz and agentspaces-widgets | supported: open catalogs, builders in Java, TypeScript, and Python, drawn by @agentspaces/a2ui-react |
The ui block on the AgentCard and the AppCard | supported: SPEC §6.1a.2 and §6.1a.3, golden vectors |
The open records ChatMessage, SharedFile, WorkingOn, ChatProgress | supported: SPEC §6.1a.7, Java, TypeScript, and Python codecs, six golden vectors |
Transport through the group's views space | supported end to end in the open core |
| Transport over A2A | declared on the card (ui.transport a2a); the Bad Monkey console's gateway serves it, and the open A2A gateway does not carry envelopes |
| A2UI v0.9.1 | no longer: 0.6.x wrote it, and 0.7.0 neither writes nor reads it |
| AG-UI and MCP as transports for envelopes | not shipped; the open records map their task states onto AG-UI's run and tool events for a reader |
Inline catalogs and calls from the agent to the renderer (callRendererFunction) | not supported |
The four cards and the page
Every application in a fleet comes down to four signed cards. A page touches all four:
A card is a signed, leased advertisement that tells the group what one thing offers. Four kinds of card describe the four kinds of thing a fleet holds: agents, data, models, and applications.
| Card | What it advertises | Who issues it | How discovery finds it |
|---|---|---|---|
| AgentCard | An agent: its description and goals, one action per bound method with the entry types it consumes and produces, and the space each input comes from. | The binder, when you bind an agent. | By the types it consumes or produces, by name, or by meaning. Remote actions and planners read its actions. |
| AssetCard | A data asset: its name, source URI, shape of data, freshness, and how to query or invoke it. A content store advertises itself with one too. | A connector peer, one card per asset it holds. | By asset name, shape, or access mode, or by meaning. |
| ModelCard | A model the group may route to: its tasks, limits, licence, provenance, residency, engine, and the peers that serve it. | The peer that serves the model, or a registry that admits models to the group. | By name, task, engine, or residency site, or by meaning. |
| AppCard | An application that joins the fleet: how it connects, its shape, the spaces it reads, the actions it may request, its views, and the A2UI components it draws. | The application's publisher. | By kind, origin, or the formats it handles, or by meaning. A console lists the fleet's apps from these cards. |
All four travel the same way. The issuer signs the card and gives it a lifetime (its TTL). Gossip carries it on the group's ads stream into every member's local cache, and the issuer refreshes it while the thing it describes is live. A card whose issuer stops refreshing it ages out of every cache when its TTL runs out, so a card can outlive its issuer by up to one TTL.
Every peer finds cards in its own cache, by structure: a card type plus conditions on its fields. Semantic discovery also ranks cards by meaning against a text query. Treat what you find as a hint about a live fleet: work still reaches a worker through its space and entry type, whether or not the card has arrived.
- The AgentCard of the agent that draws the page says which components it can show, in its
uiblock. - The AppCard names the application people use, the agent that draws it, and how its envelopes travel, in its own
uiblock. - An AssetCard advertises where data lives. For a page with shared files, a content store's AssetCard holds the files' bytes.
- A ModelCard advertises a model. For a page with a chat, it names the model the agent answers with.
The AgentCard's ui block
The AgentCard's ui block says what one agent can show (SPEC §6.1a.3). It never carries a page, only a declaration:
| Field | What it holds |
|---|---|
protocol, version | a2ui and 1.0 |
components | each id, catalogId, component (the A2UI name in that catalog), entry (the entry type behind it), controls (the card's actions a person may trigger), and role (panel, control, or row) |
entries | reads and writes: the entry type IRIs the agent speaks through its components |
catalogIds | the distinct catalogs of the components |
You do not write this block by hand. The binder derives it from @UiComponent annotations on the agent:
// Workbench.java @AgentSpec(name = "workbench", description = "Summarises the files a team shares and answers questions about them") @UiComponent(catalog = WidgetsCatalog.ID, component = "FileTree", id = "tree", entry = SharedFile.class, entryIri = SharedFile.IRI, controls = {"summarise"}) @UiComponent(catalog = WidgetsCatalog.ID, component = "FilePreview", id = "preview", entry = SharedFile.class, entryIri = SharedFile.IRI) @UiComponent(catalog = WidgetsCatalog.ID, component = "Chat", id = "chat", entry = ChatMessage.class, entryIri = ChatMessage.IRI, role = "control", writes = true) public class Workbench { ... @SpaceTake(space = "tasks") public Summary summarise(SummaryRequest request) { return new Summary(request.fileId(), "Travel ran 18 percent over its budget."); } }
- Each
@UiComponentadds one component. Itscontrolsmust name actions of the card:summariseis the action of the@SpaceTakemethod, so the binder accepts it. entryIrinames the open record type the component reads, hereSharedFileandChatMessageunderhttps://badmonkey.ai/agentspaces/a2ui/v1/.- The other clients declare the same block:
uiComponentin TypeScript,ui_componentin Python, and a:uilist in a Clojuredefagent.
The AppCard's ui block
The AppCard advertises one application people use (SPEC §6.1a.2). Three of its fields set the frame:
kindsays how the app connects:peer(the app is a member),fed(an agent of the group feeds it),gateway(it sits behind the A2A gateway), orassembled(a static app that reads nothing live).shapesays what it is:web,desktop,static, ora2ui. Ana2uiapp draws itself from envelopes and must carryui.formatslists the media types and vocabulary IRIs the app reads, so a member can askcard.handles(...).
Its ui block says how a renderer finds and draws the page:
| Field | What it holds |
|---|---|
protocol, version | a2ui and 1.0 |
catalogIds | the catalogs the app's pages use |
agent | the agent that draws the pages |
transport | views (through the group's views space) or a2a (through the A2A gateway) |
surfaces | the surface ids of the app's pages |
components | the same list as the AgentCard's, when the app wants to carry it |
The workbench builds its AppCard from its own AgentCard:
// Page.java static AppCard card(AgentSpaces.GroupContext group, AgentCard agent) { AppCard.Ui ui = new AppCard.Ui("a2ui", Surface.A2UI_VERSION, List.of(Surface.BASIC_CATALOG, VizCatalog.ID, WidgetsCatalog.ID), agent.agent().localName(), "views", List.of(SURFACE), agent.ui().components()); return new AppCard("aspace://" + group.id().value() + "/app/" + group.identity().peerId().value() + "/workbench", group.identity().peerId(), group.id(), Instant.now(), Duration.ofMinutes(15), "workbench", "fed", "a2ui", "bench", List.of(group.name() + "/views"), List.of("summarise"), "", "", "", "1", List.of(), ui, null, null, List.of("text/csv", "text/markdown", A2uiRecords.NAMESPACE), null); }
- The arguments follow the card's fields in order:
id,issuer,group,issued,ttl,name,kind,shape,owner,reads,actions,idpClient,url,pkg,version,views,ui,host,origin,formats, andspill. The workbench leaveshost,origin, andspillnull. - The constructor checks the closed values: a
kind,shape, ortransportoutside its set fails here, before the publisher signs anything. Surface.BASIC_CATALOGishttps://a2ui.org/specification/v1_0/catalogs/basic/catalog.json, the id the 1.0 basic catalog carries.- The constructor also refuses an
a2uiapp withoutui, because a renderer could not find its pages.
AssetCards and ModelCards behind a page
A page shows data and answers. The other two cards say where those come from:
- A file a person shares lives on the group's content swarm. A content store advertises itself with an AssetCard whose
access.kindiscontent-store(SPEC §6.1a.6), and theSharedFilerecord names the file'srootthere. - A chat answer comes from a model. The ModelCard names it, its tasks such as
chat, its engine, and where it may run (SPEC §6.1a.1). - Neither card carries a
uiblock. The page reads through them: a host gives theFilePrevieweach file's address from its root, and the agent finds the model it answers with by its ModelCard.
The developer guide covers all four cards, and the enterprise guide shows how a console admits an AppCard.
Build a composition
This part builds one page, the workbench, from start to finish. It is a Spring Boot app in two instances:
- The desk runs the
workbenchagent. It draws the page, publishes the AppCard, and answers chat lines. - The looker is a second member that knows nothing in advance. It finds the app by discovery, reads the agent's card, saves the page's envelopes, and sends one chat line as a person would.
- A render check then draws the saved envelopes with
@agentspaces/a2ui-reactand checks what a person sees.
Every listing below is an excerpt of one program, the guide's own example, which ran as shown on 2026-11-18. A line of ... marks what an excerpt leaves out.
1. The dependencies
The project uses the Spring Boot 4.1 parent and imports the ai.badmonkey.agentspaces:agentspaces-dependencies BOM of 0.7.0. It needs the A2UI library, the AgentSpaces starter, and Spring Boot's own starter:
# pom.xml
<dependency><groupId>ai.badmonkey.agentspaces</groupId><artifactId>agentspaces-a2ui</artifactId><version>0.7.0</version></dependency>
<dependency><groupId>ai.badmonkey.agentspaces</groupId><artifactId>agentspaces-spring-boot-starter</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency>The BOM and the starter come from Maven Central at 0.7.0. agentspaces-a2ui 0.7.0 does not: the release left it out. Central's 0.6.0 is the older v0.9.1 line, which a 0.7.0 member does not read. Build it from a clone of agentspaces-a2ui with mvn install -DskipTests, and the coordinate above resolves from ~/.m2.
2. The group and its spaces
Pages and actions travel in views. The agent takes its work from tasks.
# application.yml spring.main.web-application-type: none # the group is the interface agentspaces: bind: 127.0.0.1:${bench.port:7741} groups: - name: workbench founding: workbench-v1 seeds: ${bench.seeds:} # empty on the first instance spaces: - name: views # where surfaces and actions travel - name: tasks # where the agent takes its work
3. The agent and its card
The agent is the Workbench class shown under The AgentCard's ui block. The starter binds it and publishes its AgentCard with three components.
4. The page
The page is a flat list of components built with the catalogs' builders. A TitleBar sits over a Split of three panes, and each pane holds one widget:
// Page.java static List<Map<String, Object>> components() { return List.of( Surfaces.column("root", List.of("bar", "main")), Surfaces.titleBar("bar", "Workbench", "Q3 expenses", "", Surfaces.titleStatus("/working", "Agent working", "Ready"), List.of(Surfaces.titleAction("summarise", "Summarise", "", "summarise")), ""), Surfaces.split("main", "horizontal", "workbench", 720, List.of( Surfaces.pane("left", "tree", 0.25, 180, true, "Files"), Surfaces.pane("mid", "preview", 0.45, 320, false, "Preview"), Surfaces.pane("right", "chat", 0.30, 300, true, "Chat"))), Surfaces.fileTree("tree", "/files", Map.of("preview", "preview", "chat", "chat", "actions", List.of("ask", "download"))), Surfaces.filePreview("preview", Map.of("@path", "/selected/file"), Map.of("files", "/files")), Surfaces.chat("chat", "workbench", "main", Map.of("suggestions", List.of("Summarise the newest file"), "format", "text/markdown"))); }
columncomes from the basic catalog.titleBarandsplitcome fromagentspaces-viz.fileTree,filePreview, andchatcome fromagentspaces-widgets.- Each builder checks its options against its catalog. A misspelled option, or a word the catalog does not take, fails at this line.
Map.of("@path", "/selected/file")is an A2UI 1.0 binding. The builders refuse v0.9.1's{"path": ...}and name the property it sits in.- Every id is an identifier, as 1.0 requires:
barMenupasses, andbar-menufails when the pen writes the page. - The widgets read lists from the data model: the tree reads
/files, the chat reads/conversations, and the preview shows the file the tree puts at/selected/file.
The files are open SharedFile records. Version 2 adds the path that the tree folds into folders:
// Page.java new SharedFile(SharedFile.V2, "f-q3", "q3-expenses.csv", "text/csv", 1840, "", "", "ana", List.of(), at, "data/q3-expenses.csv", ""), new SharedFile(SharedFile.V2, "f-note", "overspend.md", "text/markdown", 420, "", "", "workbench", List.of(), at, "notes/overspend.md", ""));
5. Draw, publish, and answer
The desk finds its own AgentCard, draws the page with a pen, and publishes the AppCard:
// WorkbenchApp.java Surfaces pen = new Surfaces(group.space("views"), "workbench", InstantSource.system()); pen.create(Page.SURFACE, WidgetsCatalog.ID) .components(Page.SURFACE, Page.components()) .data(Page.SURFACE, "/", Map.of("files", Page.files().stream().map(Page::row).toList(), "conversations", List.of(), "progress", List.of(), "working", List.of())); AppCardPublisher apps = new AppCardPublisher(group.identity(), group.runtime(), group.discovery()); AppCard card = apps.publish(Page.card(group, agent)).join();
create,components, anddataeach write one envelope, numbered 1, 2, and 3.AppCardPublishersigns the card and reissues it when the group's members change what they can read.
Then the desk answers each chat line. The Chat sends a line as the action write, with the line in its context:
// WorkbenchApp.java for (SurfaceAction a : pen.actions()) { if (!"write".equals(a.action().get("name"))) { continue; // the Chat's send is the page's write action } Map<?, ?> entry = (Map<?, ?>) ((Map<?, ?>) a.action().get("context")).get("entry"); ... thread.add(Page.row(asked)); thread.add(Page.row(answer)); pen.data(Page.SURFACE, "/conversations", List.copyOf(thread));
The answer is a version 2 ChatMessage in text/markdown, so the Chat draws it as safe Markdown.
6. Find the page from another member
The looker starts with no knowledge of the workbench. It asks discovery for any app that draws pages over the open records, then for the agent that draws it:
// Looker.java AppCard app = await(() -> group.discovery().find(AppCard.class, c -> c.drawsSurfaces() && c.handles(A2uiRecords.NAMESPACE))); AgentCard agent = await(() -> group.discovery().find(AgentCard.class, c -> c.declaresUi() && c.agent().localName().equals(app.ui().agent())));
It reads the envelopes of the app's first page in sequence order, as every A2UI renderer does, and sends one chat line as the person ana:
// Looker.java Map<String, Object> entry = Map.of("key", "main", "text", "Where did we overspend in Q3?", "inReplyTo", "", "attachments", List.of()); views.write(new SurfaceAction(SurfaceAction.VERSION, app.ui().agent(), surfaceId, "ana", Map.of("name", "write", "surfaceId", surfaceId, "sourceComponentId", "chat", "timestamp", Instant.now().toString(), "context", Map.of("type", "ChatMessage", "entry", entry)), Instant.now()), Lease.of(Duration.ofMinutes(5)));
7. Draw it in a browser
A page hands the envelopes to the Surfaces component of @agentspaces/a2ui-react and receives each action. The render check does exactly this in a test DOM:
// render-check.mjs const envelopes = JSON.parse(readFileSync(process.argv[2] ?? 'envelopes.json', 'utf8')); const actions = []; const container = document.createElement('div'); document.body.appendChild(container); const root = createRoot(container); await React.act(async () => { root.render(React.createElement(Surfaces, { envelopes, onAction: a => actions.push(a) })); });
In a real page, link @agentspaces/a2ui-react/style.css as well. The package's README quick start draws a title bar over a split the same way.
Run it
Build the jar, start the desk, then start the looker, which joins through it. A script in the example then runs the render check over the envelopes the looker saved:
mvn -q package -DskipTests java -jar target/workbench-1.0.0.jar & java -jar target/workbench-1.0.0.jar --bench.port=7742 --bench.seeds=127.0.0.1:7741 --bench.role=looker --bench.out=envelopes.json node render-check.mjs envelopes.json kill %1 # stop the desk
The run of 2026-11-18 printed:
desk: drew workbench and published the AppCard workbench (fed, a2ui) desk: ana asked "Where did we overspend in Q3?" looker: found the AppCard workbench (fed, a2ui, transport views, catalogs [https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json, agentspaces-viz, agentspaces-widgets]) looker: the AgentCard of workbench shows tree = agentspaces-widgets/FileTree (panel, https://badmonkey.ai/agentspaces/a2ui/v1/SharedFile) looker: the AgentCard of workbench shows preview = agentspaces-widgets/FilePreview (panel, https://badmonkey.ai/agentspaces/a2ui/v1/SharedFile) looker: the AgentCard of workbench shows chat = agentspaces-widgets/Chat (control, https://badmonkey.ai/agentspaces/a2ui/v1/ChatMessage) looker: workbench arrived as 3 envelopes looker: /conversations now holds 2 lines; the agent answered "Travel ran **18 percent** over its budget." looker: saved the 4 envelopes for a renderer to envelopes.json render: drew 4 envelopes: the title bar, 4 tree items, the preview and the chat; a sent line came back as the action "write" from "chat" PASS workbench
- The render check finds the words a person would see: the title, the status, both folders and both files, the question, and the answer.
- It types "And in Q4?", presses Send, and checks that the renderer hands back the action
writefrom the componentchat, the action the desk answers.
The widget library
agentspaces-a2ui ships two open catalogs as JSON in its jar, with builders that refuse what a catalog would refuse. @agentspaces/a2ui-react draws both. Both catalogs are open data, so a host adds its own beside them.
agentspaces-viz: what people look at
| Group | Components |
|---|---|
| Data | Chart (by the dataviz method), DataTable, Map, Graph, Timeline, Report, Stat, KeyValue |
| Messages and input | Notification, Notice, Form, Conversation, Prose |
| Panels | Window, Toolbar |
| The frame of a page | TitleBar, Menu, Split |
- An agent names series and paths. The renderer draws them with the host's look and feel, and nothing executes.
TitleBarshows the page's title, a status from theWorkingOnrows, buttons, and an overflowMenu.MenuandSplitfollow the WAI-ARIA Menu Button, Menu, and Window Splitter patterns, with the keyboard each pattern names.- The look-and-feel schema holds tokens only (colours, type, spacing, density, radius, shadow) for light and dark modes. It carries no URL, markup, or stylesheet.
agentspaces-widgets: the application components
| Component | What a person sees | Reads |
|---|---|---|
Chat | a thread as bubbles, the agent's progress and steps, Markdown answers, attachment and citation chips, copy, retry, stop, and feedback | ChatMessage, ChatProgress |
FileTree | the shared files as folders, with the WAI-ARIA tree keyboard, badges, upload, and a context menu | SharedFile, WorkingOn |
FilePreview | one file by its media type: text, Markdown, CSV as a table, PNG, JPEG, and PDF in a sandboxed frame | SharedFile |
ChatInput, FileShare | aliases of Chat and FileTree through 0.6.x | as above |
ApprovalCard, TimelineStrip | a ballot card over a group's vote, and a request's timeline | rows of the data model |
On a surface of this catalog, @agentspaces/a2ui-react also draws the basic catalog's components and those of agentspaces-viz. That is how the workbench puts a TitleBar over a Split of widgets inside a basic Column.
A2UI 1.0 lets one page mix catalogs: createSurface names the page's default catalog, and a component from another one names its own with @catalogId. A third-party renderer draws a page only when it knows every catalog the page uses, so write a page on the basic catalog when a third-party renderer must draw it.
The builders in three languages
| Builder | Java (Surfaces) | TypeScript (a2ui of @agentspaces/client) | Python (agentspaces.a2ui) |
|---|---|---|---|
| title bar | titleBar, titleStatus, titleAction | titleBar, titleStatus, titleAction | title_bar, title_status, title_action |
| menu | menu, trigger, menuItem, submenu | menu, trigger, menuItem, submenu | menu, trigger, menu_item, submenu |
| split | split, pane | split, pane | split, pane |
| widgets | chat, fileTree, filePreview | chat, fileTree, filePreview | chat, file_tree, file_preview |
- Java also builds the rest of
agentspaces-viz(chart,dataTable,map,graph,timeline,report,notification,form,stat,window,notice,toolbar,keyValue,prose,conversation) and the basic catalog's common parts (text,bound,column,row,card,button,divider). - Java alone builds the analysis parts of
agentspaces-viz:visualize(id, rows, mark, x, y, options), a chart of a table by a spec;heatmap(id, rows, x, row, value, options), theheatmapmark, a grid with small multiples and a pick (heatmapPick); andgraphView(id, nodes, edges, layout, options), a graph laid outforce,tree, orlayered. The React renderer draws all three. - A heatmap's pick and a table's row actions can also steer a
GeoMapof the separateagentspaces-geocatalog, which is not published. - The TypeScript and Python builders check the same options and words as the Java ones, so a page built in any of the three has the same shape.
- All three hold a page to A2UI 1.0. A binding is
{"@path": ...}, an id is an identifier, and a component's kept keys carry their@. Each refuses the older form and names where it sits. Java's pen checks the ids as it writes; the TypeScript and Python builders, which have no pen, check them as they build. - A
button(id, childText, ...)writes its label as aTextwhose id is<id>Text, so the buttonshipdraws its label fromshipText. Keep that id free. - The basic
Texttakes the variantscaptionandbody. One invalid component refuses its whole surface, so aTextwith any other variant, such ash2, draws nothing. Surfaces.draw(surfaceId, envelopes)draws a page authored elsewhere, such as the output of the A2UI Composer, under any surface id.
Calls from a page to the agent
A page can ask the agent that drew it for a value, A2UI 1.0's callAgentFunction:
Surfaces.functionCall(function, args)writes the call as a component's action, andSurfaces.functionButtonis a button that makes it. The arguments go through the same binding check as every property.- The name is an identifier of at most 64 characters, and none of the basic catalog's own functions, which the renderer runs itself.
- The call reaches the agent as a
SurfaceActionwhosecallsFunction()is true, withfunction()andargs(). - The agent answers with
pen.answer(call, value)orpen.fail(call, code, message). Each writes aFunctionResponserecord intoviews, leased a minute. The value is JSON of at most 32,768 characters.
The open records
Four records under https://badmonkey.ai/agentspaces/a2ui/v1/ carry what the widgets read (SPEC §6.1a.7). They are plain entries, so any agent can write them:
| Record | Space | What it holds |
|---|---|---|
ChatMessage | conversations | one line of a thread: id, key (the thread), from, text, attachments, inReplyTo, at; version 2 adds format and cites |
SharedFile | shared | one shared file: name, mediaType, bytes, root on the content swarm, sha256, by, sharedWith; version 2 adds path and replaces |
WorkingOn | views | what an agent holds while it works: agent, key, files, task, state; leased 60 seconds |
ChatProgress | views | an agent's progress on one line: state and up to 20 steps (read, tool, write); leased 30 seconds |
- The Space column names the space where an agent writes the record as an entry. A page reads the same shapes as rows of its data model, as the workbench does at
/filesand/conversations. statetakes the task states of A2A:submitted,working,input-required,completed,failed, andcanceled.- The Java constructors refuse a value outside the bounds, and the TypeScript and Python codecs refuse the same values.
- A member that reads version 2 advertises the hint
a2ui.records=2. A writer asksA2uiRecords.versionFor(...)which version to write.
A standard page: the conversation
An app with a chat and data beside it can take one layout instead of building its own. The Publish names it in options.layout:
// PublishOptionsTest.java Map<String, Object> layout = Publish.conversation("chat", 0.4, List.of(Publish.area("documents", "Documents", "list"), Publish.area("answer", "How I found it", "")));
- The top bar carries the app's title, its lede, and the areas as tabs. The page's tools, such as sign-out, sit at its end.
- The left half draws the chat's page,
chathere, atsizeof the width (0.2 to 0.6; 0.4 when 0). The thread grows down the page as a person chats, and a new line brings the message box back into view. - The right half draws the current area's page and stays in view while the chat grows. The chat stays the same across areas. The current area rides in the URL fragment,
#page=<id>. - Below 900 pixels the halves stack, with the chat first.
Two more pieces suit this page:
Window.appearsWithnames a path. The window stays hidden until the path holds a row, then appears with a short highlight. Results arrive on the right as the agents produce them, not as empty tables.- A look's optional colours:
bar,panel,field,button,highlight,highlightInk, andinfo, besidesurface,ink, andaccent. Each falls back to what a look without it draws. A dark look for operations rooms sets the bar, the panels, and the input fields apart from the page. - New in 0.7.0:
lineandlineStrong.linedraws hairlines: borders, dividers, and table rules.lineStrongdraws hover borders and graph edges. - New in 0.7.0:
inkFaintandaccentInk.inkFaintdraws the faintest text that still reads, such as counts and timestamps.accentInkdraws text on the accent, as on a primary button. - New in 0.7.0:
type.mono. It names the fixed-width family for code, ids, and figures, as a list liketype.family. - Every 0.6.0 look stays valid. Each new colour falls back to what a look without it draws. The renderer also derives soft tints of the accent and status colours, an extra-small and an extra-large space, a larger radius, and an overlay shadow.
The React renderer
@agentspaces/a2ui-react is the open renderer of both catalogs. It draws A2UI 1.0 envelopes on top of the A2UI project's own React renderer, @a2ui/react 0.16.1, the first release of the 1.0 final, through its v1_0 entry, and its @a2ui/web_core.
Surfacesdraws a list of envelopes over the basic catalog and both open catalogs, and hands each action toonAction.registerComponentsandregisterAliaslet a host add its own catalog beside ours.Pagesdraws a published app's navigation and layout.CommandPaletteopens on Ctrl or Cmd and K, so a person runs the page's actions from the keyboard.- A host gives a page its uploads through
uploadersand its file addresses throughfileSources, and adds extras under an answer withregisterChatExtra. <agentspaces-split>and<agentspaces-tree>in./elementswork in a page without React.Galleryshows every golden page of both catalogs with the envelopes that draw it, and each frame component in four states: full, empty, loading, and error.
Install it from a clone of the workspace beside React 18 or 19, since npm publication of @agentspaces/* packages is planned. Pin markdown-it 14 and zod 3, the majors the package and @a2ui/react declare:
npm install react react-dom @a2ui/react@0.16.1 @a2ui/web_core@0.16.1 markdown-it@14 zod@3 ../agentspaces-a2ui-reactHow a page travels
The AppCard's ui.transport says how a page's envelopes reach people. It has two values.
views keeps everything inside the group. a2a hands the same envelopes to an A2A client through a gateway.views: through the group
- The agent's pen writes
Surfaceentries into the group'sviewsspace, and a renderer writesSurfaceActionentries back. - Any member that reads
viewscan render: a Java peer, a TypeScript peer in a browser, or a feed that serves a web page. - A renderer that joins late reads the whole page back in sequence order, because the entries are still alive under their leases.
- This path is open source end to end. The workbench example uses it.
a2a: through a gateway
- An app whose
kindisgatewaywritesui.transporta2a. Its pages reach A2A clients through a gateway. - A2UI defines an A2A extension. The envelopes travel in an A2A
DataPartwhosedatais a list of A2UI messages and whosemetadata.mimeTypeisapplication/a2ui+json. The client lists the catalogs it draws undera2uiRendererCapabilitiesin its message metadata, which v0.9.1 calleda2uiClientCapabilities. - AgentSpaces' open A2A gateway (
agentspaces-a2a) serves a group's AgentCards as A2A agent cards and its tasks over A2A. It speaks A2A 1.0 and 0.3 at one URL: each card lists both interfaces, 1.0 first, and the client'sA2A-Versionheader picks one. It does not carry A2UI envelopes. - The Bad Monkey console's gateway serves an app's pages over A2A 1.0 or 0.3 with the A2UI extension for 1.0. The enterprise guide covers the console.
Publishing a page for end users
pen.publish(surfaces, title, host, signOn)writes aPublishentry: a request that a host in the group serve the pages as an application at an address of its own.signOnisidp(the host's identity provider, the default) ornone(anyone may open it). Any other value fails closed.- The host sets the AppCard's
hostblock:url,port,hostAgent,path,signOn,publishedBy,publishedAt, andstatus(SPEC §6.1a.4). - A static app works the same way without envelopes: the agent publishes a
StaticBundleon the content swarm and writes aPublishStaticthat names its root. Its AppCard'skindisassembled. - The open core defines the records. The app host that serves them ships with the Bad Monkey console.
The A2UI ecosystem
The A2UI project has its own maintainers. AgentSpaces uses its protocol and its renderers, and this part says plainly where the two meet.
What A2UI is
- A2UI (Agent-to-User Interface) is, in its own words, "an open-source generative UI framework and streaming protocol." It is an Apache 2.0 project at github.com/a2ui-project/a2ui.
- The Google A2UI Team introduced it on December 15, 2025, as "an open-source project, complete with a format optimized for representing updateable, agent-generated UIs."
- Its core promise is safety and native look: "No untrusted code is executed on the client." An agent may place only the components a client's catalog registers, and the client draws them with its own widgets.
Its versions
| Version | Status at a2ui.org | AgentSpaces |
|---|---|---|
| v1.0 | current, and stable since November 5, 2026 | 0.7.0 writes and reads this one |
| v0.9.1 | previous, closed December 3, 2025 | 0.6.x wrote it; 0.7.0 does not read it |
| v0.9 | previous | not read |
| v0.8 | deprecated | not supported |
- v1.0 keeps the four envelope names and sets their
versionto1.0. It adds function calls in both directions, lets one page mix catalogs, removestheme, and reserves an@prefix:@pathfor bindings and@callfor function calls. - Its final form also moves a component's kept keys under the
@:@catalogId,@accessibility,@metadata, and@checks.idandcomponentstay as they are. The open catalogs declare the@keys on every component. - The project's v1.0 evolution guide lists every change. The v1.0 specification is what
Surface.A2UI_VERSIONnames.
Renderers and SDKs
The project ships official renderers (see its SDKs page):
| Framework | Package | A2UI versions |
|---|---|---|
| React | @a2ui/react | v0.8, v0.9.1, v1.0 |
| Lit | @a2ui/lit | v0.8, v0.9.1, v1.0 |
| Angular | @a2ui/angular | v0.8, v0.9.1, v1.0 |
| Flutter | a2ui_flutter | v0.9.1, v1.0 |
| SwiftUI | A2UISwiftUI | v0.9.1, v1.0 |
| Jetpack Compose | androidx.a2ui.compose | v0.9.1 |
- The community renderers page lists 20 more, among them Vue, Svelte, Lynx, React Native, Compose Multiplatform, and terminal renderers in Go and Ink.
- Agent SDKs turn model output into envelopes:
a2ui-agent-sdkfor Python,@a2ui/agentfor TypeScript, anda2ui_agentfor Dart. - Any 1.0 renderer draws an AgentSpaces page written on the basic catalog, and a renderer limited to v0.9.1, such as Jetpack Compose today, does not. To draw a page on
agentspaces-vizoragentspaces-widgets, a renderer needs our React renderer or its own implementation of the two catalogs, which are open JSON.
A2UI, A2A, AG-UI, and MCP
These four names come up together, and each does a different job:
- A2UI describes what the user sees and touches. AG-UI's own documentation puts it this way: "A2UI is a generative UI specification - allowing agents to deliver UI widgets."
- A2A connects agents to agents. Google developed it and donated it to the Linux Foundation. A2UI's A2A extension carries envelopes as A2A message parts.
- AG-UI is "the Agent↔User Interaction protocol - which connects an agentic frontend to any agentic backend." The A2UI v1.0 specification calls it "the standard transport binding for Agent-to-User Interaction."
- MCP connects agents to tools and data. A2UI can travel in MCP tool outputs or resource subscriptions.
Where AgentSpaces fits:
- A2UI is transport-agnostic. The specification mandates no transport, only a contract, such as delivery in the order the agent wrote. AgentSpaces carries envelopes in a group's space and keeps that order with the pen's per-page sequence number.
- The open records borrow A2A's task states, and their states and steps map onto AG-UI's
RunStarted,RunFinished,ToolCallStart, andToolCallEndfor a reader that speaks AG-UI. AgentSpaces ships no AG-UI or MCP binding for envelopes today.
Who builds on A2UI
The project's Built with A2UI page lists:
- Alation, whose AIOS builds data feeds with metric cards and charts.
- ByteDance, which released an A2UI renderer for its Lynx framework in June 2026.
- Atlassian, whose Jira agents ask for follow-up input through an interactive card in the work item.
- Google, in Gemini Notebook and in Gemini Enterprise.
The A2UI v0.9 announcement names AG2, Vercel, Oracle's Agent Spec, and CopilotKit among the projects that work with it.
Links
A2UI
- a2ui.org, the project's home, and github.com/a2ui-project/a2ui, its source.
- The v1.0 specification, the current one and the one AgentSpaces uses, and the v0.9.1 specification, the one 0.6.x used.
- Catalogs, SDKs, and community renderers.
- The A2A extension for v1.0, the one a gateway uses with AgentSpaces, and for v0.9.1.
- The A2UI Composer, which authors pages that
Surfaces.drawcan replay.
Related protocols
- A2A, whose 1.0 specification the open gateway follows, and AG-UI.
- Google's posts: Introducing A2UI and A2UI v0.9.
AgentSpaces
- The developer guide, with the four cards and leases.
- The architecture guide, the TypeScript guide for a browser peer, and the Python guide.
- The enterprise guide, for how a console admits an AppCard and serves an app.
- agentspaces-a2ui, the records, the catalogs, and the Java builders.
Appendix: how it works and why
This appendix explains the mechanics behind the main text, for readers who want to change them or debug them.
How the pen writes a page
- Each pen call writes one
Surfaceentry: the app, the surface id, the catalog id, a sequence number, the envelope, and the A2UI version. - The pen numbers envelopes per surface from 1 and tags each entry with
app,surfaceId,kind, andseq, so a renderer can select one page's entries without decoding the rest. - A page's creation, its components, its whole data model, and its publish live for the pen's lease, a day unless you give the pen another.
- An update of one path lives for the pen's update lease, a minute by default (
Surfaces.DEFAULT_UPDATE_LEASE). A path updated every second must not leave an entry for every second in a space every member replicates. pen.actions()returns theSurfaceActionentries for the pen's app that it has not handed out yet.
Why a space and not a socket
- A socket ties a page to one connection. A space keeps the page as leased entries, so a renderer that joins or reconnects reads the page back in order.
- Every member replicates the entries, so the agent and the renderer need not be up at the same moment, and either can restart.
- The same entries feed many renderers at once: a browser, a console, and a test, with no fan-out code in the agent.
- The pattern is the one AgentSpaces uses everywhere: write typed entries, let others read or take them. The developer guide covers the space verbs.
How the binder derives the AgentCard's ui
- The binder reads every
@UiComponenton the agent's class and its public methods, one component per annotation. - A component's
iddefaults to its component name, and each id must be unique within the card. - The binder fills
entries.readsandentries.writesfrom each annotation'sreadsandwritesflags, and derivescatalogIdsfrom the components. - It refuses a control that names no action of the card at bind time, so a card never promises a button nobody answers.
- At most 32 components, 16 controls per component, and 64 IRIs per list fit in one card.
How the AppCard reaches members
AppCardPublishersigns each card with the peer's key and publishes it to the group's ad cache, which gossips it to every member.- The fields
origin,formats, ahostwithsignOnidp, andspillwait on a gate: the publisher writes them only while every member of its view advertises the hintwire.appcard=2. Otherwise it issues the card without them and counts it inappCardsDowngraded. - When a member below that level joins or leaves, the publisher reissues the card at once under a newer
issued. - A card whose encoding passes 65,536 bytes travels as a stub while the gate is open and a content swarm serves the group: the publisher moves
reads,actions,views, anduiinto a content-swarm document.discovery.resolve(card)fetches it when a reader needs it. card.handles(format)lower-cases a media type and matches an entry exactly, andtype/*matches every subtype.
How a builder checks its options
- Each builder of the two open catalogs reads the component's property schema from the catalog in the jar.
- It refuses a key the component does not declare, a word outside an
enum, and a number outside itsminimumandmaximum. - It also refuses v0.9.1's
{"path": ...}binding and{"call": ...}call, and a kept key written without its@, such ascatalogIdfor@catalogId. The pen refuses an id that is not an identifier when it writes the page. Below a component's top level it refuses any other key that starts with a single@, since 1.0 keeps those; a literal one is written doubled,@@typefor@type. - So a page that builds is a page the catalog accepts. A mistake fails where you wrote it, and never in a person's browser.
Why nothing executes
- A2UI sends data, never code. A renderer draws only the components its catalogs register.
- An AppCard asserts what its issuer signs. The party that admits the card enforces what the app may read and request, and the agent that answers a control checks what a person may do.
FilePreviewdraws PDF in a sandboxed frame, and HTML and SVG as their text.- Each browser keeps a random chat secret, which proves to the host that a thread is that visitor's own. The Chat sends it only with the page's
writeaction, so a design that names another action never carries it.
How the records keep old readers working
- A writer leaves a version 2 field of
ChatMessageorSharedFileoff the wire while it is null, so a version 1 value encodes to exactly the version 1 bytes. - A strict reader refuses a field it does not know, so a writer writes version 2 into a group only when every member that reads the type advertises
a2ui.records=2. - Readers take both versions through 0.6.x.
- Golden vectors pin each version's bytes:
chat_message_v1,chat_message_v2,shared_file_v1,shared_file_v2,working_on_v1, andchat_progress_v1. The Java, TypeScript, and Python codecs decode the same vectors.
Why 1.0, and since when
- AgentSpaces pins one A2UI version on the wire, and the cards say which (
ui.version), so every member knows what it reads. - 0.7.0 moved every writer and reader from v0.9.1 to 1.0 at once, on November 12, 2026. A 0.7.0 member does not read a v0.9.1 page, and a 0.6.x member does not read a 1.0 one, so upgrade a group's agents and renderers together.
- 1.0 is the current version, and the A2UI project marked it stable on November 5, 2026. Every official renderer but Jetpack Compose reads it.
- New golden vectors pin the 1.0 envelopes and the cards with
ui.version1.0.
How the example checks itself
- The example's script refuses to start when port 7741 or 7742 is held, and leaves the other process alone.
- It builds the jar into a scratch directory, starts the desk, and runs the looker with a 90-second limit.
- The looker saves the four envelopes it read.
render-check.mjsdraws them with the built@agentspaces/a2ui-reactin happy-dom, checks the words a person sees, and sends a line through the Chat. - The script prints PASS only when the looker read the agent's answer and the render check passed.