Getting started
Install a renderer, build the system prompt, draw the reply, and take the turn back.
Three things connect a model to a screen: a system prompt that teaches the markup, a component that draws what comes back, and the callbacks through which the interface reaches your product.
Scaffold
The fastest path is a Vite + React app that already runs the prompt, stream, checker and repair loop:
npm create open-intelligent-ui@latest my-app
cd my-app && npm install && npm run devCoding agents should load skills/integrate/SKILL.md and the repository llms.txt. The chat model that writes markup only needs buildSystemPrompt(...).
Install
Install the renderer for your framework, the core, and the UI SDK package the renderer is built on.
npm install @open-intelligent-ui/react @open-intelligent-ui/core @ui-sdk/react @ui-sdk/core| Package | Needs |
|---|---|
@open-intelligent-ui/react | React 19 or later. The entry is marked "use client" |
@open-intelligent-ui/vue | Vue 3.5 or later |
@open-intelligent-ui/svelte | Svelte 5.33 or later, and a bundler with the Svelte plugin |
@open-intelligent-ui/solid | Solid 2 |
@open-intelligent-ui/web | A bundler such as Vite. Gives the <intelligent-ui> element and mount() |
All packages are ESM with type declarations. open-intelligent-ui, without a scope, re-exports @open-intelligent-ui/core.
Build the system prompt
On the server, where you call the model:
import { buildSystemPrompt } from "@open-intelligent-ui/core/prompt"
const system = buildSystemPrompt({
instructions: "You are the support desk assistant for Acme.",
tools: [
{
name: "listTickets",
kind: "read",
description: "Tickets in the support queue.",
input: { status: "open | pending | solved | all" },
output: "[{ id, subject, status, priority, assignee }]",
},
{ name: "updateTicket", kind: "write", description: "Change a ticket.", input: { id: "string", status: "?" } },
],
})Send system as the system message of any chat API. The prompt holds the language, the primitives and presets, the UI SDK components, motion, craft, the design and your tools. It is about 34,000 characters by default; the API reference lists the options that shorten it.
Draw the reply
Pass the reply so far on every chunk. Draw one <IntelligentUI> per assistant turn; each has its own state.
import { IntelligentUI } from "@open-intelligent-ui/react"
import "@open-intelligent-ui/react/styles.css"
function Reply({ text, streaming }: { text: string; streaming: boolean }) {
return (
<IntelligentUI
source={text}
streaming={streaming}
tools={{ listTickets, updateTicket }}
onAction={(action) => {
if (action.type === "send") askModel(action.text, action.data, action.state)
return undefined
}}
onWarning={(message) => console.warn(message)}
/>
)
}- Give it a width. The surface is a size container and lays itself out for the space it gets, from a phone column to a full page.
- UI SDK components load on first use. Call
preloadUiSdk()early, orpreloadUiSdk("Tabs", "Dialog"), if you want none of that wait. - Server rendering. Hydrating server-rendered output hasn't been tested. Draw the surface in the browser:
<ClientOnly>in Nuxt,clientOnlyin SolidStart, a client component in Next.js for the props that are functions. - A code fence around the reply. Some models wrap their reply in one despite being told not to. Strip it before drawing; the checker reports it as
fenced.
Check the reply
Before a finished reply is kept, check it, and let the model fix what is wrong. This is the loop, on the server:
import { checkMarkup, repairMessage } from "@open-intelligent-ui/core/check"
const tools = ["listTickets", "updateTicket"]
let reply = await model(messages)
let result = checkMarkup(reply, { tools })
for (let round = 0; !result.ok && round < 2; round++) {
messages.push({ role: "assistant", content: reply }, { role: "user", content: repairMessage(result) })
reply = await model(messages)
result = checkMarkup(reply, { tools })
}Correct output explains what it catches and how to use it while streaming.
Take the turn back
When the reader makes a decision, the markup calls send("Book the Kyoto option", { id }). Your onAction receives the sentence, the data and the surface's state. Add it to the conversation as a user message and ask the model again:
function askModel(text: string, data: unknown, state: Record<string, unknown>) {
messages.push({
role: "user",
content: `${text}\n\n<context>${JSON.stringify({ data, state })}</context>`,
})
startTurn(messages)
}Next
- The markup: what a model writes, with every example drawn live.
- Data, tools and turns: how a surface reads and writes without a model call.
- Design, your components, charts, motion: making it yours.
- The playground: eleven demos, five renderers, and a live mode for your own model key.
