A2UI 1.0 demo · Flutter · Gemini

Generative UI in a health app: how much should the model decide?

We built VitalLoop, a health tracker whose screens arrive from Gemini as A2UI JSON and draw themselves in Flutter while they are still being written. Here is how it works, and where we put the limits.

The short answer

VitalLoop in 60 seconds

VitalLoop is an open-source (Apache 2.0) demo health tracker from OakTree Apps. Its tracking screens are not pre-built in Dart. A Python agent gives Gemini a screen template for each step, Gemini replies in A2UI 1.0 JSON, and the Flutter app renders it with a2ui_flutter as the JSON streams in. Google’s A2UI 1.0 announcement lists it among the partner demos.

What you can log. Pain, symptoms, vitals, medications and food, followed by a daily summary with care nearby and a PDF report.

The components. 28 in total: 18 from the A2UI basic catalog and 10 written for this app.

The stack. Flutter, a2ui_flutter and a2ui_core, Python with Google’s Agent Development Kit (ADK), the A2A protocol, Gemini and Cloud Run.

Our rule. People design the screens, the model writes the content that changes, and Dart code assigns every status label on a vital sign.

VitalLoop is a demo. It is not medical software and it gives no medical advice.

Watch a pain check-in build itself

We recorded this against the live demo on 5 December 2026. The app is on the left. On the right is the wire inspector, which lists every A2UI message as it arrives.

Body map, pain level, notes and saved entry. No audio. The recording is a sequence of captured frames, so waiting time is shorter than in real use.

What is A2UI?

A2UI is an open-source generative UI framework that lets an AI agent describe a user interface as data. The agent sends declarative JSON that names components your app already supports, and your app draws them with its own widgets. The agent does not send code for your app to run. The project is published under Apache 2.0 at a2ui.org.

Google announced A2UI 1.0 on 11 November 2026. The release made the protocol stable and added function calls in both directions, accessibility support and extensions for extra metadata. VitalLoop uses three of its core messages:

A2UI messageWhat it does
createSurfaceOpens a new screen area and names the component catalog it uses.
updateDataModelSets the values that components are bound to.
updateComponentsSends the components themselves, linked to each other by ID.

Why try generative UI on a health tracker?

A health check-in changes with what you report. Lower back pain calls for a body map and a severity scale. A blood pressure reading calls for two rulers and a status label. A symptom list works better when it can change.

In VitalLoop each flow is a folder of JSON templates and a prompt on the server. The server reads them on every request, so we can reword a question or reorder a step without shipping a new app build, as long as the app already has the components.

Health software also has little room for surprises. A form that rearranges itself, a reading labelled one way today and another tomorrow, or a clinic that does not exist would each cost a user’s trust. So we built what we call template-guided generative UI: people write each screen as an A2UI template, and the model fills it in, writes the parts marked for it and streams the result.

What you can log in VitalLoop

VitalLoop dashboard with Pain, Symptoms, Vitals, Medications and Food options, showing one pain entry and one vitals entry logged
The dashboard counts today’s entries. The summary button unlocks once something is logged.
FlowWhat you log or getCustom components
PainWhere it hurts, how much, when it started, notesBodyMapPicker, SeverityInput
SymptomsSymptoms from a list Gemini suggests, severity, notesSeverityInput
VitalsBlood pressure, heart rate, temperature, blood sugarOne input card for each reading
MedicationsMedicine suggestions, dose and scheduleMostly the basic catalog
FoodMeal type, items, serving size, meal timeIconBadge
Daily summaryToday’s entries, an overview written for your doctor, care nearby, a PDF to shareCareMap, CareList, PdfReport
BodyMapPicker component showing the back view of a body with left and right lower back selected
Body map. The button reads “Continue · 2 areas”. A2UI functions work that out on the device, so selecting an area needs no model call.
SeverityInput component showing pain level 7 out of 10 marked Severe
Severity scale. The number, colour, face and wording all change as you move along the scale.
Vitals screen with a blood pressure card reading 118 over 76 and a heart rate card with an ECG style trace at 72 bpm
Vitals. Rulers for blood pressure and an animated ECG-style trace for heart rate, both ordinary Flutter widgets placed by the generated screen.

Finding care nearby

The daily summary can look for hospitals, clinics and doctors. You type a city or area, so the app never asks for your device location. What you logged that day decides the kinds of care it searches for: knee pain points to orthopedic clinics, while a very high blood pressure or a high fever puts emergency rooms first.

  1. The server finds the city’s centre with OpenStreetMap.
  2. Gemini searches with Grounding with Google Maps, on the same API key. There is no separate Maps key to set up.
  3. Gemini picks places and gives a short reason for each one.
  4. The map and the list share one value in the data model, so picking a place in the list also marks it on the map.
  5. The place you pick appears on the report screen. It is not written into the PDF.
Care nearby screen: a map of California with a pin for each place, above a card for an emergency department with rating, reason, address and directions button
A live search for “California”, 5 December 2026. CareMap pins each place and CareList shows the rating, the reason for the suggestion and the address. Map data © OpenStreetMap contributors.

Listings come from Google Maps through Gemini and are not recommendations by OakTree Apps. A search can return an incomplete list or none at all. Call ahead, and in an emergency call your local emergency number.

How a screen gets made

  1. You tap a flow. The app sends a start message to that flow’s agent over A2A. Each flow has its own address, such as /pain.
  2. The agent briefs Gemini. It sends the flow’s instructions, the current time and the flow’s screen templates.
  3. Gemini writes the screen. It replies with the A2UI messages for that step, filling {{placeholders}} with your earlier answers.
  4. The app draws it as it arrives. a2ui_core processes each message and a2ui_flutter renders Flutter widgets.
  5. Your tap goes back as an action. The button sends its action name and the values bound to it, and the agent answers with the template mapped to that action.

Here is part of the first pain screen, abridged from the repository:

{
  "version": "1.0",
  "updateComponents": {
    "surfaceId": "pain_step_1_body_area",
    "components": [
      { "id": "map_card", "component": "Card", "child": "body_map" },
      { "id": "body_map", "component": "BodyMapPicker",
        "value": { "@path": "/bodyAreas" } },
      { "id": "next", "component": "Button", "variant": "primary",
        "child": "next_content",
        "action": { "event": {
          "name": "bodyAreasSelected",
          "context": { "bodyAreas": { "@path": "/bodyAreas" } } } } }
    ]
  }
}

@path binds a component to a value in the data model on the device. The picker writes your selection to /bodyAreas, and the button sends it only when you tap.

Where we want fresh content, the template says so. This is from the medication flow:

"options": {
  "$ai": "6 common medicines people log at home ... Generic names only,
          no doses. Pick a different, varied set each time.",
  "example": [ { "label": "Paracetamol", "value": "Paracetamol" } ]
}

$ai is our own template convention and is not part of the A2UI specification. The example doubles as a fallback: if Gemini leaves a marked part unfilled, the server uses the example so the screen still works.

Streaming: the screen fills from the top down

Waiting for the complete JSON reply would leave the phone blank longer than needed. Our server reads the reply while Gemini is still writing it and forwards only what is safe to draw:

  • It sends createSurface together with the first visible content, so you do not see an empty surface.
  • It sends only complete components that can be reached from the root.
  • It cuts each container’s list of children at the first unfinished one, so no component points at something the app does not have yet.
  • When Gemini finishes, it parses the whole reply and sends the final screen. If the JSON is broken, it asks once more.
VitalLoop body map screen beside a wire inspector listing updateComponents messages growing from 3 to 13 components
The wire inspector during step 1. The surface grew from 3 to 13 components as Gemini wrote.

In that run the first components reached the app about 8 seconds after the tap, and the surface then grew from 3 to 13 components in about 1.6 seconds. This is a single observation, not a benchmark. It does show that streaming helps once the model starts writing, and that you still need a good loading state before then.

What the model decides, and what it does not

Part of the screenWho decidesHow
Components and their orderPeopleTemplates in server/flows/, which Gemini is instructed to keep unchanged
Suggested symptoms and medicines, summary textGeminiGenerated for each request
How a component looks and behavesFlutterWidgets in the app’s catalog
Status label on a vital signDart codeFixed ranges in lib/models/vitals/
What you picked or typedYouHeld in the data model, sent when you tap a button
Clinics and hospitals listedGoogle Maps, checked by the serverPlaces the search did not return are dropped

Status labels stay in code

The blood pressure chip is not a model opinion. It is a plain Dart function, shortened here:

if (systolic < 90 || diastolic < 60)    return 'Low';
if (systolic >= 140 || diastolic >= 90) return 'High · stage 2';
if (systolic >= 130 || diastolic >= 80) return 'High · stage 1';
if (systolic >= 120)                    return 'Elevated';
return 'Normal';
Blood pressure card labelled High stage 2 beside the live A2UI data model showing systolic 200 and diastolic 76
Move the ruler and the data model and the label update together, with no request to the model.

The ranges roughly follow the adult categories used by heart associations. In a demo they are a guide, not a diagnosis.

Places have to be real

For care nearby, Gemini calls a search tool that uses Grounding with Google Maps. In the screen it returns only an ID and a short reason for each place it picks. The server adds the name, address and position from the search results and drops any ID the search never returned, so an invented hospital cannot enter the place list.

The catalog is the contract

An A2UI catalog is the set of components and functions an app can render. Each component has a JSON schema for the properties it accepts. If a screen names something outside the catalog, the app has nothing to draw it with. These are the 10 we wrote:

ComponentWhat it is
BodyMapPickerFront and back body figure with tappable regions
SeverityInput1 to 10 severity scale
BloodPressureInputSystolic and diastolic rulers with a status label
HeartRateInputHeart rate with an ECG-style trace and tap-your-pulse
TemperatureInputThermometer slider with °C and °F
BloodSugarInputGlucose band with mg/dL and mmol/L
IconBadgeColoured icon used in rows and headers
CareMapMap of nearby care
CareListList of nearby care, with the reason for each
PdfReportThe daily report as a PDF to share or print
BloodPressureInput card with systolic and diastolic rulers and a Normal label, from the VitalLoop component catalog
BloodPressureInput in the catalog site, which shows every component with a live preview, its JSON and its schema. Browsing it needs no API key.

What we learned building it

1. Set exact values in code

Gemini sometimes shortened our catalog ID. A2UI 1.0 has no fallback catalog, so the app could not draw a screen carrying an ID it did not know. The server now writes the correct ID onto every createSurface itself.

2. “Keep this unchanged” is a request to the model

We ask Gemini to keep template text and layout as written, yet it still rewrites the whole screen on each step. For a production health product we would assemble the fixed parts in code and ask the model only for the parts that need generating, as we already do for place details.

3. Design the wait

Streaming cannot start before the model does. A screen needs a clear loading state, and an error path that tells the user what happened.

4. Pin versions and read the spec changes

On 11 November 2026 the A2UI specification renamed a button’s validation key from checks to @checks. The a2ui_core release we use does not read the new name yet, so our templates still say checks.

5. Leave the API key with its owner

The public demo uses your Gemini key, not ours. The browser keeps it for the tab’s session, it travels in a request header over HTTPS, and the server does not save it. A per-address rate limit protects the service.

A2UI, A2A, AG-UI and MCP Apps: which does what?

The names look alike and they solve different problems. You can combine them.

NameWhat it handlesIn VitalLoop?
A2UIDescribes an interface as declarative dataYes, version 1.0
A2ALets agents and applications communicate. Started at Google and now under the Linux FoundationYes, carries the messages
AG-UIEvent protocol between an agent and a front end, and a documented transport for A2UINo
MCP AppsLets an MCP server show its own HTML interface inside a host application, in a sandboxNo

Run VitalLoop on your machine

You need Flutter 3.41 or newer, Python 3.11 or newer and a Gemini API key. Start the server first:

git clone https://github.com/oaktreeapps/vital-loop.git
cd vital-loop/server
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python main.py

Then, in a second terminal:

cd vital-loop/client
flutter pub get
flutter run

The app asks for your key when it opens. The client and server test suites run offline, with no key.

Quick answers

Frequently asked questions

What is A2UI?

A2UI is an open-source generative UI framework under Apache 2.0. An AI agent describes an interface as declarative JSON that names components from a catalog, and the receiving app draws those components with its own widgets. Google announced version 1.0 on 11 November 2026.

What is VitalLoop?

VitalLoop is an open-source demo health tracker built by OakTree Apps with Flutter, A2UI 1.0, Google’s Agent Development Kit and Gemini. It logs pain, symptoms, vitals, medications and food, then writes a daily summary. It is listed among the partner demos in Google’s A2UI 1.0 announcement.

Does Gemini design the screens in VitalLoop?

No. People write each screen as an A2UI template. Gemini fills in earlier answers, writes the parts that are meant to change, such as suggestion lists and the daily summary, and streams the finished screen back.

How do you render A2UI in a Flutter app?

Add the a2ui_flutter and a2ui_core packages, define a catalog of the components your app supports, feed the agent’s messages into a2ui_core’s MessageProcessor and render the resulting surfaces. Button taps come back from the processor as actions that you send to your agent.

Is generative UI safe to use in a health app?

It depends on what the model is allowed to control. Keep clinical rules in tested code, restrict the model to a fixed component catalog, verify any real-world facts on the server and treat prompt instructions as guidance that still needs checking. A real product also needs clinical, privacy and regulatory review.

Is VitalLoop HIPAA compliant or medical software?

No. VitalLoop is a demo with no compliance claim. What you enter is sent to the Gemini API to build the next screen, and the city you type for care nearby is also sent to OpenStreetMap, so do not enter real patient information.

Do I need an API key to try it?

You need your own Gemini API key to run the flows, which you can create in Google AI Studio. The How it works page and the component catalog open without a key.

Thinking about generative UI for your product?

We build Flutter apps and the agent back ends behind them. Bring us a flow that changes often, and we will map out what a model should and should not touch.

Sources
  1. Google Developers Blog: A2UI 1.0 announcement, 11 November 2026.
  2. A2UI protocol specification, version 1.0.
  3. A2UI independent consultancy directory, which lists OakTree Apps and VitalLoop.
  4. VitalLoop source code on GitHub.
  5. a2ui_flutter and a2ui_core on pub.dev.
  6. Agent Development Kit documentation.

The A2UI project states that it does not endorse, rank or certify the companies in its directory. VitalLoop’s body map is adapted from the Daily Health Tracker project (Apache 2.0).