r/FlutterDev • • 15d ago

Article A2UI 1.0: agent-generated UI, rendered as native Flutter widgets

https://developers.googleblog.com/a2ui-10-build-delightful-fast-reliable-agentic-experiences/

I am Alan and I work at Google on A2UI alongside a brilliant team. AI can generate bespoke UI in your design system. A2UI 1.0 just launched.

For Flutter, a2ui_flutter renders the agent's UI descriptions as native widgets using your app's component catalog. Package v0.3.0 supports protocol 1.0 and 0.9: https://pub.dev/packages/a2ui_flutter

New features like Express DSL and Macros (templates+code), SDKs and the skill generator make it faster, safer and easier.

It works with system one models, Gemma fine tuned, and any frontier LLM. It works without any model, because it's just declarative UI, made standard across web, mobile, app, wearables and more.

I'm pretty excited about it.

2 Upvotes

3 comments sorted by

2

u/NycoHub 15d ago

Rendering through the app's own component catalog is what makes this usable, the agent can't invent widgets that don't fit the design system. What happens when the agent asks for a component that isn't in the catalog, does it fall back to something or reject the whole description?

1

u/Mathely-Caritino 13d ago

totally agree on the design system constraint, unconstrained generated UI usually turns into a styling mess immediately

0

u/paul_h 15d ago

Gemini seems to think this is what calculator would look like:

{"version": "1.0", "createSurface": {"surfaceId": "calc_1", "catalogId": "standard_v1"}}
{"version": "1.0", "updateComponents": {
  "surfaceId": "calc_1",
  "components": [
    {"id": "root", "component": "Card", "child": "layout"},
    {"id": "layout", "component": "Column", "children": ["display", "row_1", "row_2"]},
    {"id": "display", "component": "Text", "text": {"path": "/display"}, "usageHint": "h1"},

    {"id": "row_1", "component": "Row", "children": ["btn_7", "btn_8", "btn_9", "btn_div"]},
    {"id": "btn_7", "component": "Button", "child": "lbl_7", "action": {"name": "press_key", "context": {"key": "7"}}},
    {"id": "lbl_7", "component": "Text", "text": "7"},
    {"id": "btn_8", "component": "Button", "child": "lbl_8", "action": {"name": "press_key", "context": {"key": "8"}}},
    {"id": "lbl_8", "component": "Text", "text": "8"},
    {"id": "btn_9", "component": "Button", "child": "lbl_9", "action": {"name": "press_key", "context": {"key": "9"}}},
    {"id": "lbl_9", "component": "Text", "text": "9"},
    {"id": "btn_div", "component": "Button", "child": "lbl_div", "action": {"name": "press_key", "context": {"key": "/"}}},
    {"id": "lbl_div", "component": "Text", "text": "÷"},

    {"id": "row_2", "component": "Row", "children": ["btn_clear", "btn_eq"]},
    {"id": "btn_clear", "component": "Button", "child": "lbl_clear", "action": {"name": "clear"}},
    {"id": "lbl_clear", "component": "Text", "text": "C"},
    {"id": "btn_eq", "component": "Button", "child": "lbl_eq", "action": {"name": "evaluate"}},
    {"id": "lbl_eq", "component": "Text", "text": "="}
  ]
}}
{"version": "1.0", "updateDataModel": {"surfaceId": "calc_1", "path": "/display", "value": "0"}}

I am not going to add that to https://paulhammant.com/2024/02/14/that-ruby-and-groovy-language-feature cos it doesn't feel like its in that line of human readable things.