/assistant-ui:generative-uifrom assistant-ui
Enables model-driven UI composition at runtime using a component vocabulary, supporting the present tool, backend-driven MessagePrimitive.GenerativeUI, Slack/Teams renderers, A2UI surfaces, and OpenUI integration.
Ships in assistant-ui. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Always consult assistant-ui.com/llms.txt for the latest API.
Generative UI inverts the usual tool-rendering relationship. Instead of one hand-written component per tool call, you ship a vocabulary of components and let something assemble a tree from it: either the model, through the present tool, or your backend, through a message part or a LangGraph event. @assistant-ui/generative-ui ships a default vocabulary of 29 components (cards, facts, tables, charts, forms, controls) plus converters that turn the same tree into Slack Block Kit or a Microsoft Teams Adaptive Card, and one that turns an A2UI surface into it, so a composition built once can render in the browser and outside it.
defineGenerativeComponents_action dispatch, createActionRegistry, and the $input shapes interactive components send backMessagePrimitive.GenerativeUI and its allowlist, the Slack and Teams converters, and why the two spec shapes do not interchangeTwo questions separate the patterns: does the model compose the layout or do you bind it ahead of time, and does the UI originate from a tool call or from a part your backend emits.
| Pattern | API | Best for |
|---|---|---|
The present tool | JSONGenerativeUI + present | The model composes dashboards, cards, and layouts from a vocabulary you ship |
| Tool UI | toolkit render (see tools) | A widget tied to one tool call you already know about |
| Generative UI primitive | MessagePrimitive.GenerativeUI + allowlist | A backend that already emits generative-ui message parts |
| LangGraph data UI | makeAssistantDataUI + ui_message | LangGraph agents emitting UI on the LangGraph stream, see assistant-ui.com/docs/runtimes/langgraph/generative-ui |
| OpenUI | @openuidev/assistant-ui, third party | Already invested in the OpenUI ecosystem and its component kit |
The first two are tool-driven, so the model decides when UI appears; the LangGraph row is backend-driven, so your agent does. present and the generative UI primitive both take a JSON component tree, but in non-interchangeable shapes, see Spec shape differences. A tree built for present is also the shape the Slack and Teams converters accept and the A2UI converter produces.
Install the package, add the styled element, and enable the "use generative" compiler for your framework:
zod is an optional peer dependency imported by the /react entry, so install it with the package.
npm install @assistant-ui/generative-ui zod
npx assistant-ui@latest add generative-ui
import { withAui } from "@assistant-ui/next";
export default withAui({
/* your Next config */
});
Vite and TanStack Start use aui() from @assistant-ui/vite (plugins: [aui({ ... })]); Expo and bare React Native use const { withAui } = require("@assistant-ui/metro"); in metro.config.js. The directive lets one file declare tools that both the browser and your server route import: the compiler strips the browser-only halves from the server build and the schemas from the client build.
JSONGenerativeUI turns a component library into the model-facing schema for present. Register the result on a toolkit like any other tool:
"use generative";
import { defineToolkit } from "@assistant-ui/react";
import {
JSONGenerativeUI,
defaultGenerativeUILibrary,
} from "@assistant-ui/generative-ui/react";
const generative = new JSONGenerativeUI({
library: defaultGenerativeUILibrary,
});
export default defineToolkit({
present: generative.present({ display: "standalone" }),
});
display: "standalone" renders the result on its own surface, outside the chain-of-thought trace; omit it to render inline. The default vocabulary is already a working setup with no components of your own, see vocabulary.md for the full list and how to extend it.
Register the toolkit on the client through AuiConfig, and set sendAutomaticallyWhen so the run continues once the frontend tool resolves:
"use client";
import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
import { useChatRuntime } from "@assistant-ui/ai-sdk";
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
import toolkit from "./toolkit";
export function MyRuntimeProvider({
children,
}: {
children: React.ReactNode;
}) {
const runtime = useChatRuntime({
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
});
const config = AuiConfig({ tools: Tools({ toolkit }) });
return (
<AssistantRuntimeProvider runtime={runtime} config={config}>
{children}
</AssistantRuntimeProvider>
);
}
present is a frontend tool: it resolves in the browser, and without sendAutomaticallyWhen the UI renders and the conversation stops before the model says anything else.
The route imports the same toolkit module. The compiler resolves that import to the server build, so only the schemas cross over and no browser code enters your server bundle:
import { openai } from "@ai-sdk/openai";
import { AISDKToolkit } from "@assistant-ui/ai-sdk";
import { convertToModelMessages, stepCountIs, streamText } from "ai";
import toolkit from "@/app/toolkit";
const aiToolkit = new AISDKToolkit({ toolkit });
export async function POST(req: Request) {
const { messages, tools } = await req.json();
const result = streamText({
model: openai("gpt-5.6-luna"),
messages: await convertToModelMessages(messages),
stopWhen: stepCountIs(10),
tools: await aiToolkit.tools({ frontend: tools }),
});
return result.toUIMessageStreamResponse();
}
When no backend of yours imports the toolkit module, for example a cloud-hosted run, compile with backendless: true so the client keeps every schema uploadable, including present's:
export default withAui({ ...yourConfig, aui: { backendless: true } });
npx assistant-ui@latest add generative-ui, run above, installs the shipped stylesheet plus components/assistant-ui/elements/generative-ui.tsx, which exports styledGenerativeUILibrary: the same 29 components with a real markdown renderer swapped in for the default plain-text one. It is a "use client" module, so wiring it into a "use generative" toolkit file follows the client-module rule in the gotchas below; see tokens.md for the exact override pattern, the data-aui styling hooks, and the token arrays.
_action: actions.md.generative-ui message part your backend already emits, with MessagePrimitive.GenerativeUI and a consumer-provided allowlist: renderers.md.present renders the UI, then the conversation just stops
present is a frontend tool; without sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls on useChatRuntime, the run never continues after it resolves.The model never learns about present on a cloud-hosted backend
aui: { backendless: true } when no server of yours does.styledGenerativeUILibrary breaks the "use generative" build
"use client" module. A "use generative" file may reference it only as the inline render value inside a defineGenerativeComponents call, never as a spread, a top-level constant, or the library option directly. Passing it straight to library works only in a plain file with no "use generative" directive; see tokens.md.A generative-ui message part renders nothing
Thread does not wire MessagePrimitive.GenerativeUI. Opt in explicitly in your message renderer; see renderers.md.Unknown component name: silent drop versus thrown error
present tool path drops an unrecognized _type and warns in development. The generative UI primitive throws a typed GenerativeUIRenderError unless you pass Fallback. Neither boundary constrains the props those components receive; validate href/src values yourself and never forward agent-supplied props into dangerouslySetInnerHTML.Slack or Teams output does not match the browser
warnings array. Only a $type tree built for present converts; the primitive's { component, props } shape has no Slack, Teams, or A2UI converter.useChatRuntime never emits a native generative-ui part
tool-call parts, not generative-ui parts. Bridge with a render_gui tool whose result you parse into a spec yourself (the docs call that helper parseRenderGuiResult; it is not a package export); see renderers.md."use generative" compiler, and tool UI for a widget tied to one specific tool callgenerative-ui styled element and the rest of the catalogMessagePrimitive and the other unstyled building blocksAuiConfig, Tools, and the rest of the config plumbingWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub assistant-ui/skills --plugin assistant-ui17 skills in this plugin
/assistant-uiOverview and router for assistant-ui, the React library for building AI chat interfaces from composable primitives and a styled elements catalog. Use for high-level, cross-cutting, or architecture questions: choosing packages, picking a runtime, or understanding the layers (elements, primitives, the aui client with AuiConfig and AuiProvider, the runtime, adapters) and the message model. Covers `@assistant-ui/react` 0.15.x, `@assistant-ui/ai-sdk` for AI SDK v7 (`useChatRuntime`), `@assistant-ui/core`, `@assistant-ui/store`, `assistant-stream`, `assistant-cloud`, the LangGraph, LangChain, Google ADK, A2A, AG-UI, Eve, OpenCode, and Pi adapters, the `@assistant-ui/react-native` and `@assistant-ui/react-ink` bindings, and the `useAui`, `useAuiState`, and `useAuiEvent` hooks. For a specific area route to a focused sibling instead: setup, elements, primitives, runtime, tools, generative-ui, streaming, cloud, thread-list, copilots, markdown, react-mcp, observability, react-native, ink, or update./cloudAdds AssistantCloud backed persistence, authorization, and telemetry to assistant-ui apps. Use when wiring cross-session thread and message history, multi-device chat, message feedback, file uploads, or auth: passing `cloud` to `useChatRuntime` from `@assistant-ui/ai-sdk`, `AISDKThreads({ cloud })` for `AuiConfig` hosts, or `cloud` on `useLangGraphRuntime`. Covers constructing `AssistantCloud` with `authToken` (JWT), `apiKey` plus `userId`/`workspaceId` (server-side only), or `anonymous`; Clerk, Auth0, Supabase, and Firebase integrations and a backend token endpoint; the `cloud.threads`, `cloud.files`, `cloud.runs`, and `cloud.telemetry` client surface; and a custom `ThreadHistoryAdapter` on `CloudMessagePersistence`. Route here for threads that do not persist, 401s against the cloud API, or feedback buttons that do not save. For the `<ThreadList />` sidebar UI use thread-list; for the general adapter contracts use runtime.Other plugins' skills for the same job