openui block, and Fleet Pi parses and renders it progressively as tokens arrive.
Use generative UI when a card, table, chart, metric, or action row communicates more clearly than prose — for example, dashboards, status summaries, comparisons, or “what would you like to do next?” prompts that route back into the conversation.
When it applies
Generative UI is on by default in Agent and Plan modes. The system prompt for each mode includes the OpenUI component contract, so any Pi chat response can return inline UI without extra configuration.
In Plan mode the numbered plan stays in Markdown — OpenUI is reserved for compact visual summaries and decision aids, and
Button actions are disabled.
How it works
OpenUI Lang is a declarative DSL designed for LLMs. Each line assigns to an identifier, and the first line must assign toroot. The renderer parses lines as they stream and shows skeletons for any forward references until they arrive.
Available components
The Fleet Pi component library covers layout, content, status, data, state-bound inputs, and one safe action primitive. Fleet Pi uses OpenUI Lang 1.1 (@openuidev/react-lang and @openuidev/lang-core 1.1).
Reactive state
Declare reactive variables with$name = defaultValue and bind them to inputs. Input binds a text value, Select a chosen option, Switch a boolean, and Modal a boolean that controls whether the dialog is open. Changing an input recalculates every expression that depends on it. State lives in the rendered block, not in Pi.
@ prefix: @Count(array), @Sum(numbers), @Avg(numbers), and @Filter(array, field, op, value). Bare names without @ are not supported.
Actions
Button is the only action primitive. A button runs one action, or several actions in order inside Action([...]):
@ToAssistant("...")sends that message back into the chat as a new user turn. A button with no action sends its label.@Set($variable, value)and@Reset($variable)change reactive state inside the rendered block.
@OpenUrl actions. Buttons are disabled in Plan mode.
Example
A status summary the agent might stream:"Run the OpenUI validation checks" as a normal chat message.
Authoring rules the agent follows
Fleet Pi’s system prompt enforces these constraints on every response:- Wrap each program in a fenced ````openui` block. The rest of the response stays in Markdown.
- Every program starts with
root = Root(...). - Use only components from the library — invented names or named arguments are rejected.
- Arguments are positional. Write
Card("Title", child), notCard(title: "Title", content: child). - Keep blocks chat-sized; prefer Markdown for long prose, explanations, or raw code.
- Give each button one action, such as
@ToAssistant("..."), or wrap several steps inAction([...]). Never use@OpenUrl,Query(),Mutation(), or@Run. - In Plan mode, never emit
Buttoncomponents.
Error handling
If the model emits invalid OpenUI Lang — unknown components, unresolved references, or schema violations — Fleet Pi renders an inline diagnostic panel under the message with the parser errors and the raw output, so you can see exactly what the model produced and why it failed. Streaming responses suppress unresolved-reference errors until the stream completes.Related
Chat modes
How Agent, Plan, and Harness modes change tool allowlists and OpenUI rules.
OpenUI Lang reference
Full OpenUI Lang language specification from Thesys.