跪拜 Guibai
← All articles
Flutter · Agent · Frontend

A2UI 1.0: Flutter's Generative UI Gets Guardrails, Multi-Catalogs, and a 46% Token Cut

By LinXunFeng ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Guardrails catch invalid nesting before any render, Express halves generation latency, and callAgentFunction makes generated UIs into real tools. That combination moves GenUI from a research demo to something a team can ship and debug.

Summary

Generative UI for Flutter is moving beyond chat boxes. A2UI 1.0, the framework behind Flutter's genui package, now called a2ui_flutter, lets AI agents respond with real, interactive Flutter interfaces instead of text. The release splits the old package into a2ui_core, a2ui_flutter, and a2ui_agent, and drops the Transport abstraction so projects can use their own SSE, WebSocket, or HTTP layers.

The five new capabilities target the practical problems that kept GenUI demos out of production. Hierarchical guardrails use allowedParents and allowedChildren in the component catalog, visible in the model prompt and re-checked at render time, so a Button can't silently contain a DataTable. The Express reasoning format rewrites component trees as function calls, cutting a five-component example's character count by 46% and halving a medical dashboard generation from 10 to 5 seconds. Multi-catalog support lets platform and business teams own separate component catalogs. callAgentFunction lets deterministic clicks like steppers and sliders call backend functions directly, updating order cards in under a second without a model round-trip. Extended metadata attaches route markers, security context, and trace tokens to surfaces, components, catalogs, and actions.

Takeaways
— A2UI 1.0 released November 17; the genui package renamed to a2ui_flutter and split into a2ui_core, a2ui_flutter, and a2ui_agent.
— a2ui_flutter 0.4.0 depends on a2ui_core ^0.8.0; basic catalog is basicCatalog() in a2ui_flutter/basic_catalog.dart, not the blog's CommonCatalog.
— Transport abstraction removed; SSE, WebSocket, and HTTP are left to the project.
— Hierarchical guardrails add allowedParents and allowedChildren to component schemas, enforced in the prompt and at render; invalid nesting returns UNALLOWED_CHILD with a JSON Pointer path.
— processMessages throws A2uiValidationError on guardrail failure; callers must catch it.
— Express format cuts characters by 46% for the same five components vs minified JSON; GenUI Clinic dashboard generation went from 10s to 5s.
— A surface can mix multiple catalogs with priority ordering; platform and business teams can maintain separate catalogs.
— callAgentFunction lets deterministic actions (steppers, sliders) call backend functions directly; portfolio order card updates weight, fees, cash in under a second.
— Metadata extensions attach to surfaces, components, catalog definitions, and actions; Python example uses CreateSurface with extensions field.
— Agent SDKs: Dart a2ui_agent (Genkit Dart preview), Python a2ui-agent-sdk (ADK, A2A), TypeScript @a2ui/agent (Node.js, CopilotKit).
Conclusions

Removing the Transport abstraction is a sane decision: project-specific transport is already in place, and forcing a package wrapper only adds friction.

Two-layer validation for component nesting—rules visible in the prompt and re-checked at render—is a workable compromise between model freedom and UI integrity.

callAgentFunction is the capability that turns generated UIs from static screenshots into interactive tools, since it avoids a model round-trip for every micro-adjustment.

Express format's token reduction directly attacks the streaming latency that makes GenUI feel sluggish, so the 46% figure is worth measuring on your own models.

Concepts & terms
GenUI (Generative UI)
An AI agent returns a real, interactive user interface instead of a text reply, allowing the user to click, edit, and scroll directly.
Express format
A compact, function-call style representation of A2UI component trees that reduces the number of tokens a model must generate, cutting latency.
Hierarchical guardrails
allowedParents and allowedChildren constraints on component nesting, enforced both in the model prompt and at render time to prevent invalid layouts.
callAgentFunction
A mechanism that lets deterministic UI actions (like steppers or sliders) invoke backend functions directly, bypassing the LLM for sub-second updates.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗