gen ui demo
Two Claude tool-use calls in series. Stage 1 picks components from a tiny web-component library and fills them with content. Stage 2 arranges them into a layout. The renderer is plain Svelte. The LLM never writes code.
try it
Pick a starter prompt or write your own. Currently running on mocks — full Anthropic wiring lands next.
Or try:
how it works
user prompt
▼
stage 1 LLM
pick components
+ fill content
+ fill content
▼
json component list
json component list
stage 2 LLM
decide layout
▼
layout json
layout json
svelte renderer
deterministic
▼
final UI
- Stage 1 — content + component selection
-
Anthropic Messages API call with a tool schema describing each
component (name, description, prop types). The model returns its choices
as
tool_useblocks. The app parses them into a flat array of{ component, props }pairs. The model never returns JSX, HTML, or CSS. - Stage 2 — layout decision
-
Second Messages API call. The component array from Stage 1 is the
input. The tool schema defines a recursive grid layout
(
type,columns,children,span). Output is a single layout object referencing components by index. - Stage 3 — deterministic render
- A recursive Svelte component walks the layout JSON and renders each web component with its filled props. Plain application code. No LLM involvement. Predictable, testable, debuggable.
what this proved
- The composition / rendering split holds. The LLM reasons about which components and what content; the application code draws. Each side is good at its job.
- Tool schemas are the contract. Constraining all model output to typed JSON eliminates the code-correctness and injection risks that block production use of free-form LLM output.
- A well-designed design system is the substrate. Framework-agnostic web components with constrained props were the right shape for this years before generative UI was a real category. The original prototype validated AXS’s architecture as durable against the GenAI paradigm shift.
stack
- Frontend
- Astro, Svelte 5, Lit web components
- Pipeline
- Anthropic Messages API, two-stage tool use, async generator stream
- Hosting
- Cloudflare Pages + Pages Functions
- Original prototype
- Svelte, Node.js, AWS Bedrock with Claude tool use
Full write-up: Generating UI Without Generating Code · source on github