Let the model compose an interface at runtime from a component vocabulary you ship, with spec mode or the present tool from @assistant-ui/generative-ui.
With generative UI, you ship a vocabulary of components and the model assembles them at runtime, instead of you writing one component per tool. The model reaches the vocabulary in one of two ways. In spec mode it streams a flat spec with state, bindings, and conditions, and gets validation issues back to fix. With the present tool it sends one JSON tree. Start with spec mode for a new app; use present for A2UI surfaces, for promptUser(), and for text that grows as it streams.
The package ships a default vocabulary of 35 components (cards, facts, tables, charts, tabs, steps, timelines, citations, diagrams, maps, forms, controls), so the shortest useful setup registers one tool and writes no components at all.
Which generative UI pattern?
assistant-ui uses "generative UI" for more than one thing. Two questions separate them: does the model compose the layout or do you bind it ahead of time, and does the UI come from a tool call or from a part your backend emits.
| Pattern | API | Best for |
|---|---|---|
| Spec mode (recommended) | toSpecCatalog + createSpecToolkit | The model composes dashboards, forms, and plans from a vocabulary you ship, with state and validation |
The present tool | JSONGenerativeUI + present | A2UI surfaces, waiting on the user with promptUser(), and text that streams in |
| Tool UI | toolkit render | A widget tied to a tool you already know about (forms, pickers, charts) |
| 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 |
The first three are tool-driven, so the model decides when UI appears; the last two are backend-driven, so your agent does. OpenUI is a third-party option in the tool-driven space that streams OpenUI Lang through the same tool shape.
To decide between Markdown, present, spec mode, and a model-written widget for one answer, see Choosing an answer format. Browse every component of the default vocabulary in the component vocabulary reference, read how individual components behave in Generative UI vocabulary, and see finished compositions in the Generative section of Elements.
Quick start
This quick start registers the present tool. Spec mode has its own setup, and the registration pattern is the same.
Install the package
npm install @assistant-ui/generative-ui zodThe vocabulary renders as unstyled semantic HTML with data-aui attributes. Add the styled library to get the shipped look:
npx shadcn@latest add @assistant-ui/generative-uiThe @assistant-ui namespace resolves the Radix or Base UI flavor from your project's style through the style-aware registry entry in components.json. Without that entry, add by direct URL instead:
npx shadcn@latest add https://r.assistant-ui.com/base/generative-ui.jsonMain Component
npm install @assistant-ui/generative-ui@^0.0.13 zodassistant-ui dependencies
npm install beautiful-mermaid leaflet react-markdown remark-gfm tw-shimmer@^0.4.14This merges the vocabulary stylesheet and theme variables into your CSS, which is what the rest of this page assumes, and lands components/assistant-ui/elements/generative-ui.tsx. That file exports styledGenerativeUILibrary, which differs from the default vocabulary in three entries: a real markdown renderer, and a drawn Diagram and Map (see Diagrams and maps); Styling wires it in.
Enable the compiler
The "use generative" directive lets one file declare tools that both the browser and your server route can import. Add the build plugin as described in Defining Tools: withAui from @assistant-ui/next, aui() from @assistant-ui/vite, or withAui from @assistant-ui/metro.
Expose the vocabulary as a tool
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.
Register the toolkit on the client
Registration is the same Tools({ toolkit }) call as for any toolkit (Registering a toolkit); the addition is sendAutomaticallyWhen.
"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>
);
}Warning
present is a frontend tool: it resolves in the browser, and the run only continues once its result is sent back. Without sendAutomaticallyWhen, the UI renders and the conversation then stops.
Serve the schema
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 aiSDKTools = await aiToolkit.tools({ frontend: tools });
const result = streamText({
abortSignal: req.signal,
model: openai("gpt-6-luna"),
messages: await convertToModelMessages(messages, { tools: aiSDKTools }),
stopWhen: stepCountIs(10),
tools: aiSDKTools,
});
return result.toUIMessageStreamResponse();
}stopWhen matters here for the same reason sendAutomaticallyWhen does: rendering the UI is one step, and the model needs another to say anything after it. For the rest of the server setup, see Backend tools.
Ask for something the vocabulary can express, for example "show me a sales dashboard for the last six months", and the model will answer with a rendered composition. The complete setup runs in examples/with-generative-ui.
How present and promptUser() register
new JSONGenerativeUI({ library, actions?, imageOrigins? }) produces two tool definitions:
The toolkit key is yours to choose. Use present and prompt_user as the examples do; A2UI needs the key present, because the surfaces it synthesizes are present tool calls.
export default defineToolkit({
present: generative.present({ display: "standalone" }),
prompt_user: generative.promptUser(),
});Three things follow from how the compiler and the package split the two builds:
- Only literal method calls pass. The compiler leaves
generative.present(...)andgenerative.promptUser(...)alone whengenerativeis a top-levelconst generative = new JSONGenerativeUI(...)in the same file, imported from@assistant-ui/generative-ui/react. Any other call in a toolkit entry, such as a wrapper function, is a compile error. The package, not the compiler, produces the two halves: itsreact-serverexport condition yields a schema-only tool for your route, and the default condition addsexecuteandrenderfor the browser. - The client does not upload the schema. The client build marks
presentandprompt_useras already known to your backend, so a route that imports the toolkit (step 5 above) is what teaches the model about them. A toolkit in a file without the"use generative"directive carries the same marker, so the model never sees itspresenttool. That is what A2UI wants, since the agent emits the surfaces, but it is not what you want for a model-drivenpresent. - Without a backend of your own, compile with
backendless. The client then keeps thepresentandprompt_userschemas uploadable.
What the model emits
Every node is a flat object: _type names the component, children nests, and every other key is a prop.
{
"_type": "Card",
"title": "Q3 revenue",
"children": [
{
"_type": "Row",
"children": [
{ "_type": "Fact", "label": "Bookings", "value": "$1.2M" },
{ "_type": "Fact", "label": "Growth", "value": "+18%" }
]
},
{
"_type": "Chart",
"variant": "bar",
"showAxis": true,
"data": [
{ "label": "Jul", "value": 22 },
{ "label": "Aug", "value": 26 },
{ "label": "Sep", "value": 31 }
]
}
]
}_type, _key, and _action are reserved by the framework, as is every key beginning with $ (such as the injected $status), and children follows the JSX convention. The model writes the reserved keys with _ because Anthropic rejects tool schemas with $ in property names; trees built in code, such as converter output and the UIElement type, write them as $type, $key, and $action, and both spellings render the same. Every other key is yours, so a component is free to declare props named type, status, or variant without colliding.
Extending the vocabulary
defineGenerativeComponents adds your own components. Each one declares a zod schema for its props, a description the model reads, and a render function.
"use generative";
import { z } from "zod";
import {
JSONGenerativeUI,
defaultGenerativeUILibrary,
defineGenerativeComponents,
} from "@assistant-ui/generative-ui/react";
import { WeatherCard } from "@/components/weather-card";
const generative = new JSONGenerativeUI({
library: {
...defaultGenerativeUILibrary,
...defineGenerativeComponents({
Weather: {
description: "Show a weather card for a `get_weather` result.",
properties: z.object({
id: z.string().describe("The `id` returned by `get_weather`."),
}),
render: (props) => <WeatherCard {...props} />,
},
}),
},
});Set streamProperties: true alongside properties to receive partially-filled props while the model is still writing them. render then sees Partial<P> and an injected $status of "streaming", and the full props once it turns "done". Components opt out by default and render only once their props are complete.
Warning
Inside a "use generative" module, a "use client" module may be referenced only as the render value of an inline defineGenerativeComponents literal. The compiler drops render and the imports only it uses from the server build; referencing such a module from properties, description, a spread, or a top-level constant leaks a client reference into the server graph and breaks schema generation. defaultGenerativeUILibrary is safe on both builds.
Actions
Pass an action registry to let rendered nodes call back into your app. The model puts an _action object on a node, and its type is matched against your handlers.
import {
JSONGenerativeUI,
createActionRegistry,
defaultGenerativeUILibrary,
} from "@assistant-ui/generative-ui/react";
const actions = createActionRegistry({
purchase: async ({ payload }) => {
await checkout(payload);
},
});
const generative = new JSONGenerativeUI({
library: defaultGenerativeUILibrary,
actions,
});{
"_type": "Button",
"label": "Buy",
"_action": { "type": "purchase", "sku": "pro-plan" }
}Without a registry, the tree still renders and model-emitted actions degrade to a no-op. Unknown action types are ignored and warn in development.
Warning
In a "use generative" file the compiler keeps the whole new JSONGenerativeUI({ ... }) call in both builds, actions included; it strips only the render of components you define inline, and only from the server build. A handler and the modules it imports therefore reach your server bundle. Keep handlers free of browser-only imports, for example by having them call an API route.
Undo window
Set undoable for sends and other hard-to-reverse actions. The button waits five seconds, shows Undo with a countdown, and another click or Escape cancels it.
{
"_type": "Button",
"label": "Delete order",
"undoable": true,
"_action": { "type": "delete_order", "orderId": "48213" }
}Control values
Select, Input, DatePicker, Checkbox, Slider, RadioGroup, and CheckboxGroup add the user's value as $input when they fire the action; Slider sends a number and a CheckboxGroup sends the array of its checked option values. Form, and a Card with asForm set, add an object keyed by each control's name instead. On a Card the collected object is dispatched through confirm._action, or through the card's own _action when confirm has none, while cancel._action always fires without $input.
Set required on Input, Select, DatePicker, Checkbox, RadioGroup, or CheckboxGroup to prevent empty form submissions. Input also accepts minLength and maxLength for text, or min and max when inputType is "number". Web and Vue use browser validation messages; React Native blocks invalid submissions, while Slack and Teams use their supported input constraints and warn when a constraint cannot be represented.
Input accepts an optional inputType of "text", "password", or "number" for a single line control, defaulting to text. A number input uses step="any" and keeps its value as a string, including decimal values such as "12.5" and "" when cleared. Setting multiline renders a textarea instead.
Slider takes min, max, an optional step, defaultValue, and unit; it shows the live value and commits only when the adjustment finishes. Set Checkbox variant to "switch" for a switch presentation without changing its boolean value. RadioGroup and CheckboxGroup options can add a short description, rendered under the label.
DatePicker accepts inputType "date" (the default), "time", or "datetime". Its own _action runs once per committed value: a pick from the native picker commits at once, and a typed value commits on blur or on Enter outside a form. Date values use YYYY-MM-DD; time values use HH:mm or HH:mm:ss; datetime values use YYYY-MM-DDTHH:mm with optional seconds, fractional seconds, and an offset (Z or ±HH:mm). A datetime with an offset displays in the viewer's time zone and submits with the same offset; one without an offset submits unchanged.
A control resets to its initial value (defaultValue, defaultChecked, or a DatePicker's value) whenever a re-render changes that value, and otherwise keeps what the user entered.
Each renderGenerativeUI or JSONGenerativeUI render scopes native radio names, so separate cards can reuse a logical name without clearing each other's selection. Inside the same render and form scope, radio groups with the same logical name share one selection. The logical name remains the key for form values and $field references. If you mount multiple independent React apps on the same page, configure distinct identifierPrefix values and use each app's same prefix for server rendering and hydration.
Field references
Any value inside _action can be a { "$field": name } reference instead, which resolves to a control's current value when the action fires. It reads the control with that name in the nearest enclosing Form or Card with asForm, or else anywhere in the same JSONGenerativeUI render, collected the way a Form collects it. When no control holds a value, a reference written as { "$field": name, "fallback": value } resolves to its fallback, and one without a fallback is dropped. Input and Select take a defaultValue, so a button can send an edited value without a form:
{
"_type": "Col",
"children": [
{
"_type": "Input",
"name": "note",
"label": "Delivery note",
"defaultValue": "Leave at the door"
},
{
"_type": "Button",
"label": "Save",
"_action": { "type": "save_note", "note": { "$field": "note" } }
}
]
}A component outside the default vocabulary that dispatches $action itself reads no control, so each reference in it resolves the same way. Such a component can resolve references against its own values before it dispatches: resolveFieldReferences(action, fields) from @assistant-ui/generative-ui replaces each reference with the matching value in fields, falling back the same way, and hasFieldReference(action) tells whether an action carries any. A tree rendered with renderGenerativeUI directly resolves references only inside one of those forms or an element marked data-aui="root", so they never read a host page's own form.
On Slack and Teams the decoders resolve these references from the platform's own state: see Inbound and Inbound.
Recording and prompt_user results
Each dispatched action, including its $input, is recorded on the tool call on a best-effort basis. Recording depends on the runtime and the interaction log's limits, and it never delays or prevents dispatch. When the UI is registered through promptUser(), a handler's non-undefined return value becomes the prompt_user tool result only when that call has no result yet. Whether the run then continues depends on the runtime, including how it treats human tools. present actions never create a tool result.
Once answered, a prompt_user locks its controls and shows the submitted values. Only values submitted through a Form or a Card with asForm are restored after a reload.
Spec mode
In generative-frame's spec mode, the model builds the UI as a flat spec, streamed as JSON Patch lines, with state, bindings, and validation. toSpecCatalog from @assistant-ui/generative-ui/spec turns a library into the catalog and components spec mode takes, so the default vocabulary, or a styled library, renders there too. Moving to spec mode maps a present tree onto a spec.
Set up spec mode
Install generative-frame alongside the package, then build the catalog and a widget toolkit in a client module. createWidgetToolkit registers render_spec next to the frame tools (read_me, show_widget, edit_widget, and preview_widget), so the model can also answer with a sandboxed widget when the vocabulary cannot express something.
"use client";
import {
createWidgetToolkit,
useWidgetInstructions,
} from "generative-frame/assistant-ui";
import { createSpecToolkit } from "generative-frame/spec/assistant-ui";
import { defaultGenerativeUILibrary } from "@assistant-ui/generative-ui/react";
import { toSpecCatalog } from "@assistant-ui/generative-ui/spec";
import { approveOrder } from "@/lib/orders";
const { catalog, components } = toSpecCatalog(defaultGenerativeUILibrary, {
actions: {
approve_order: {
description: "Approves the order in `orderId`.",
params: {
type: "object",
properties: { orderId: { type: "string" } },
required: ["orderId"],
},
},
},
});
export const widgets = createWidgetToolkit({
spec: createSpecToolkit(catalog, {
components,
handlers: {
approve_order: (params) => approveOrder(String(params["orderId"])),
},
}),
});
export function WidgetInstructions() {
useWidgetInstructions(widgets.tools);
return null;
}Register widgets.toolkit like any other toolkit, with the same sendAutomaticallyWhen as the quick start, and render <WidgetInstructions /> inside the provider. It puts the guidance of the spec module of read_me in the system prompt, so the model writes a spec without calling read_me first. useWidgetInstructions(widgets.tools, { preload: { modules: [] } }) leaves that guidance on demand instead, which shortens the prompt at the cost of a read_me call before the first spec.
"use client";
import {
AssistantRuntimeProvider,
AuiConfig,
Tools,
} from "@assistant-ui/react";
import { useChatRuntime } from "@assistant-ui/ai-sdk";
import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
import { WidgetInstructions, widgets } from "./widgets";
export function MyRuntimeProvider({
children,
}: {
children: React.ReactNode;
}) {
const runtime = useChatRuntime({
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
});
const config = AuiConfig({ tools: Tools({ toolkit: widgets.toolkit }) });
return (
<AssistantRuntimeProvider runtime={runtime} config={config}>
<WidgetInstructions />
{children}
</AssistantRuntimeProvider>
);
}These tools run in the browser and upload their schemas, so your route only forwards them. Spread frontendTools(tools ?? {}) into the streamText tools as in Client-defined tools, with the same stopWhen as the quick start. The quick start's aiToolkit.tools({ frontend: tools }) forwards them too, so that route needs no change.
To use spec mode next to present, merge the two toolkits in module scope, in a client module and not in the "use generative" file, since the compiler cannot analyze a spread entry. Do not build the merged object inside the component: a new object on every render re-registers every tool (Registering a toolkit).
import toolkit from "./toolkit";
import { widgets } from "./widgets";
const config = AuiConfig({
tools: Tools({ toolkit: { ...toolkit, ...widgets.toolkit } }),
});Events and bindings
A spec element binds behavior with on instead of carrying _action. A Button and a ListViewItem emit press, the value controls emit change (an Input emits submit), a Form emits submit, and a Card emits cancel from its cancel button and confirm from its confirm button or, with asForm, whenever it submits. The payload, which { "$event": "" } reads, is the control's value, or every named control's value when a Form emits submit or a Card with asForm emits confirm. A control whose value prop (defaultValue, defaultChecked, or a DatePicker's value) is bound with $bindState follows that state and writes every change back to it, inside a Form too. Declare host actions through actions so the model can bind them; setState is always available. The moving guide maps each present construct to its spec equivalent.
Your own components
Your own components take part through the same library entry. Declare the events a component emits and the slots it renders: $dispatch({ type, $input }) emits a declared event, the element's $action carries the first one when the element binds it, default slot content arrives as children and any other slot in $slots, and slots: [] takes no children. A prop the spec binds with $bindState arrives as its current value, and $bindings holds a setter that writes a new one back to state. The present tool ignores events and slots, and present mode passes neither $slots nor $bindings. Declaring either on a vocabulary component replaces its spec events, slots, and description, so give the override its own description too, since the vocabulary's description covers present behavior.
import {
defaultGenerativeUILibrary,
type GenerativeUIComponent,
} from "@assistant-ui/generative-ui/react";
import { toSpecCatalog } from "@assistant-ui/generative-ui/spec";
import { z } from "zod";
import { Stars } from "@/components/stars";
const Rating: GenerativeUIComponent<{ value: number }> = {
description: "A 1 to 5 star rating the user can change.",
properties: z.object({ value: z.number().describe("Stars, from 1 to 5.") }),
events: ["rate"],
slots: [],
render: ({ value, $bindings, $dispatch }) => (
<Stars
value={value}
onChange={(stars) => {
$bindings?.value?.(stars);
$dispatch?.({ type: "rate", $input: stars });
}}
/>
),
};
const { catalog, components } = toSpecCatalog({
...defaultGenerativeUILibrary,
Rating,
});With Vue
@assistant-ui/generative-ui/vue ships the vocabulary as Vue components for SpecRenderer from generative-frame/spec/vue, with vue as an optional peer. Its toSpecCatalog takes a Vue library and the same actions option, and every component renders the same data-aui markup, emits the same events with the same payloads, and writes bound values back the same way as the React vocabulary, so the stylesheet and the behavior above carry over:
import { defineComponent, h } from "vue";
import { SpecRenderer } from "generative-frame/spec/vue";
import {
defaultGenerativeUILibrary,
toSpecCatalog,
type GenerativeUIComponent,
} from "@assistant-ui/generative-ui/vue";
import { z } from "zod";
import { Stars } from "@/components/stars";
const Rating: GenerativeUIComponent = {
description: "A 1 to 5 star rating the user can change.",
properties: z.object({ value: z.number().describe("Stars, from 1 to 5.") }),
events: ["rate"],
slots: [],
component: defineComponent({
props: ["value"],
emits: ["rate", "update:value"],
setup(props, { emit }) {
return () =>
h(Stars, {
value: props.value,
onChange: (stars: number) => {
emit("update:value", stars);
emit("rate", stars);
},
});
},
}),
};
const { catalog, components } = toSpecCatalog({
...defaultGenerativeUILibrary,
Rating,
});A Vue entry carries a component instead of a render function. The component follows the Vue component contract: it declares its props and the events it emits, receives children and named slots as Vue slots, and writes a bound prop by emitting update:<prop>. To render render_spec calls in an @assistant-ui/vue thread, pass the catalog and components to createSpecToolkit from generative-frame/spec/assistant-ui/vue (assistant-ui on Vue).
With React Native
On React Native, @assistant-ui/generative-ui/spec resolves to a React Native build through the react-native export condition: toSpecCatalog and defaultGenerativeUILibrary from it draw the same vocabulary with React Native's own components, with the same events, payloads, and bound values. Generative UI on React Native shows the setup and the components that take a different form on a phone.
Component behavior
Generative UI vocabulary describes how individual components behave beyond their props, in present and spec mode alike: chart scales and tooltips, table formats and sorting, carousels, tabs, steps, timelines, citations, checklists, diagrams, and maps.
Styling
The vocabulary renders semantic HTML tagged with data-aui and data-aui-* attributes and ships no styles of its own, so it cannot conflict with your CSS. The generative-ui registry item above installs the shipped stylesheet, which is written entirely against your existing theme variables: change --radius or --primary in your own CSS and the rendered widgets follow.
A Card is a module the reader scans or acts on, such as a summary, a checklist, a form, or one option in a comparison, so it renders as a panel: a fill from the vocabulary's --aui-panel token, with no border. A card inside another card stays plain, so a module never nests a second panel. A card takes on a framed surface where one is warranted: when the model sets a background, when confirm or cancel add a footer whose buttons need a delimited target, or when it is a carousel slot.
To restyle a single component, target its attribute:
[data-aui="fact-value"] {
font-variant-numeric: tabular-nums;
font-size: 1.125rem;
}Overriding a component's markup rather than its appearance is a library-level change: spread defaultGenerativeUILibrary and replace that one entry through defineGenerativeComponents. The default Markdown renders its source as plain text, and Diagram and Map draw nothing, which is why the registry item ships replacements. Wiring them is the same override:
import { styledGenerativeUILibrary } from "@/components/assistant-ui/elements/generative-ui";
const markdown = defaultGenerativeUILibrary.Markdown!;
const diagram = defaultGenerativeUILibrary.Diagram!;
const map = defaultGenerativeUILibrary.Map!;
const generative = new JSONGenerativeUI({
library: {
...defaultGenerativeUILibrary,
...defineGenerativeComponents({
Markdown: {
properties: markdown.properties,
streamProperties: markdown.streamProperties,
description: "A markdown string, rendered with GitHub-flavored markdown.",
render: styledGenerativeUILibrary.Markdown!.render,
},
Diagram: {
properties: diagram.properties,
description: diagram.description,
render: styledGenerativeUILibrary.Diagram!.render,
},
Map: {
properties: map.properties,
description: map.description,
render: styledGenerativeUILibrary.Map!.render,
},
}),
},
});styledGenerativeUILibrary is a "use client" module, so this inline render is the only place a "use generative" file may name it. Passing it directly as library works only in a file without the directive.
Security
The library is the boundary on which components can render: the model can only name components you put in it, resolved by lookup with no eval and no dynamic import. Unknown names are dropped.
Props are a separate question. Each component's properties schema shapes the present tool parameters the model sees, and when several components declare a prop with different schemas, the parameters offer each one. The renderer checks props only to keep such a shared prop's value away from a component whose schema rejects it while another declaring component's schema accepts it, so declare every value a component can render: a value: z.string() component loses a number that a value: z.number() component in the same library accepts. Treat props as untrusted input: validate URLs and values passed to APIs, and sanitize content rendered as raw HTML. Components with streamProperties: true can also receive partial props while the model is streaming, so account for incomplete values.
The model chooses every image URL, so loading an image sends a request to an origin the model picked, and that URL can carry anything the model has read. When your app handles private data, pass imageOrigins with the origins you trust, to JSONGenerativeUI or to toSpecCatalog; the built-in Image renders its alt text for an image from any other origin. The built-in Image also loads with referrerPolicy="no-referrer", so the request does not carry the page's address. A custom component that renders images must apply both itself.
Beyond the browser
The tree is plain JSON, so it is not tied to the browser. The package root, /slack, /teams, and /a2ui let a server action, queue worker, or webhook handler consume the tree without pulling React, while /react and /spec import it and /vue imports Vue:
@assistant-ui/generative-uiholds the tree types, normalization, token enums, andresolveFieldReferences.@assistant-ui/generative-ui/specexportstoSpecCatalogandToSpecCatalogOptionsto build a generative-frame spec catalog from a generative UI library.@assistant-ui/generative-ui/spec/treeexportsspecToUISpec, which turns a spec into the tree the Slack and Teams converters take.@assistant-ui/generative-ui/vueexportstoSpecCatalog,defaultGenerativeUILibrary, and theGenerativeUIComponentandGenerativeUILibrarytypes for the same catalog with Vue components.@assistant-ui/generative-ui/slackconverts the tree into Block Kit and decodesblock_actionsback into$action. See Generative UI on Slack.@assistant-ui/generative-ui/teamsconverts it into an Adaptive Card and decodes the submit payload. See Generative UI on Microsoft Teams.@assistant-ui/generative-ui/a2uiconsumes A2UI surfaces over AG-UI.