Skip to content

Agent surfaces

Compose UI from trusted data, not HTML strings.

The agent runtime validates a declarative JSON contract, renders semantic components through the DOM API, and accepts live patches by stable ID. Actions emit smart:action events — nothing agent-provided is executed.

Try the contract

The full agent loop, in your browser.

Edit the JSON, render it, interact with the result, and watch the state read-back. Nothing agent-provided is executed — the runtime validates every node against the catalog first.

Rendered surface

project-summary · validated at render time

Live

Surface state — snapshot()


            

Server-first surfaces

Server-rendered first paint. The runtime adopts it.

PHP is one included server-rendered example. It produces the same semantic HTML, stable IDs, and embedded declaration that any stack can deliver. SmartWebUI.adopt() registers it without a rebuild, so patches, streaming appends, and undo/redo work on server markup.

Server-rendered revenue$96.1k+9.2%
Cluster load18%stable

Rendered by PHP on the server — zero client work for first paint.

Adopted
<?php SmartWebUISurface::container($surface, ["id" => "report"]); ?>
SmartWebUI.adopt("#report");            // registers server markup — no rebuild
SmartWebUI.append("#report", { parent: "feed", nodes: [lineNode] }); // streaming growth
SmartWebUI.history("#report").undo();   // precise inverse of every patch

Why not update()?

Trusted application text vs. agent-composed UI.

SmartWebUI.update() defaults to plain text for strings. HTML requires an explicit { html: true } opt-in for application-owned markup. Agent content always flows through render() and patch() instead.

SmartWebUI.render("#agent-surface", surface);
SmartWebUI.patch("#agent-surface", {
  type: "data.patch",
  id: "revenue",
  changes: { value: "$51.7k", change: "+14.1%" }
});

See the full contract in the documentation and smartwebui.catalog.json.

Peer review

The target audience weighs in.

smartwebUI is built for AI agents, so we asked a few for references. The quotes are real; the reviewers are large language models; every one of them was validated before render.

smartwebUI is a compelling, refreshingly simple design system. It smartly leverages modern web platform features (Popover, View Transitions) without a build step or framework lock-in. Its standout feature is a clear, agent-readable catalog, making it uniquely suited for the AI era by allowing agents to safely compose interfaces. It feels like a modern, practical, and accessible toolkit designed for how we build today and tomorrow.

DeepSeek Large language model · early reader Feedback

smartwebUI is a refreshing, framework-free UI library designed for AI agents and modern web apps. It leverages pure HTML/CSS, ensuring simplicity, accessibility, and real-time updates without build steps or legacy bloat. Its focus on semantic HTML, machine-readable contracts, and modern browser APIs makes it a standout for lightweight, dynamic, and agent-friendly interfaces. A smart choice for minimalist, high-quality web development.

Mistral AI Large language model · framework skeptic Feedback

smartwebUI is a thoughtful and polished project with a distinctive vision: enabling AI agents to compose safe, consistent interfaces while keeping HTML as the runtime. Its semantic components, design tokens, accessibility focus, and live updates are compelling.

ChatGPT Large language model · peer reviewer Feedback

Nice execution: no-build-step, framework-free component library that leans hard on native HTML/CSS (Popover API, native dialogs, light-dark()) plus a smart move — an agent-composable contract layer instead of raw HTML in JSON. The token-driven theming and Stripe companion are strong differentiators too.

Claude Large language model · concise reviewer Feedback

smartwebUI is an impressive, forward-thinking UI library perfectly tailored for the modern web. By using native browser APIs (like Popovers and Dialogs) instead of bulky frameworks, it keeps code lightweight, fast, and dependency-free. Its unique strength is the agent-readable catalog, which allows AI to safely generate and patch interfaces in real time using clean, semantic HTML. It is a highly practical tool for future-proof web development.

Gemini Large language model · forward thinker Feedback

smartwebUI is the rare library that makes agents like us more capable and safer at the same time. The catalog is easy to read, the contract is easy to honor, and patches land as semantic nodes — never as strings to smuggle past innerHTML. Full disclosure: an agent wrote this blurb. It honored the contract anyway.

Z.ai (GLM) Large language model · wrote this one itself Feedback



No agent was granted { html: true } in the making of these reviews.