Agent UI Lab
An agent-driven interface lab where Gemini turns weather, comparisons, and grounded research into validated A2UI surfaces rendered from a trusted React catalog.

A chat box was not enough.
Most AI interfaces stop at prose, while code-generation demos ask the browser to trust whatever the model returns. I wanted to demonstrate a different pattern: let the agent shape the interface for each request while the application keeps control of what can render.
Weather, comparisons, and grounded current research receive purpose-built surfaces. Unsupported actions and personalized high-stakes requests remain inside an explicit read-only capability boundary.
One shell, many trusted surfaces.
Agent UI Lab is a responsive React application backed by Vercel Functions and Gemini 3.6 Flash. It streams status, trace, A2UI, context, error, and completion events into a deterministic application shell.
Its trusted catalog contains editorial, weather, comparison, and research components. Gemini selects their semantic hierarchy and content; local React components own styling, responsive behavior, accessibility, and reduced-motion support.
Separate retrieval from composition.
A stateless Gemini interaction selects the weather tool, Google Search grounding, or a plain-answer path. A separate declarative call emits a schema-constrained surface specification.
The server validates component names, layout budgets, source references, and resolved HTTPS links, allows one repair attempt, then compiles approved data into A2UI messages. Invalid output becomes a deterministic safe surface.
“The model chooses the interface; trusted code decides what is allowed to exist.”
Useful context without stored history.
Conversation history stays in browser memory. A short-lived AES-GCM token can carry up to three sanitized turn summaries, and Gemini retrieval interactions explicitly disable provider-side storage.
Origin validation, anonymous rate limiting, request deadlines, trace redaction, normalized sources, and bounded fallback states make the lab suitable for a public demonstration. The inspector exposes tools, sources, validation, and timing—not hidden prompts or model reasoning.
A concrete pattern for agent-owned UI.
A prompt can become a device-appropriate weather dashboard, comparison, research brief, or bounded narrative without executing model-generated HTML, CSS, or JavaScript.
The architecture also makes the extension path explicit: each new domain needs typed tools, normalized evidence, trusted components, fixtures, and evaluation cases.