Dynamic UI (SGUI)
Dynamic UI (Static Generative UI, or SGUI) lets agents render pre-registered UI components inside the Control UI. Agents never send raw HTML. They select a component ID, provide props, and always include a textFallback for non-UI clients.
Where it appears
- Control UI renders the UI components.
- CLI / Discord / non-UI clients show the
textFallbackstring.
Enable or disable
Dynamic UI is gated by the gateway config:
If disabled, ui_present still requires textFallback, and the Control UI will ignore UI render payloads.
Registry & components
The registry is stored locally at:
Current registry components:
stat_grid— compact KPI snapshotsline_chart— interactive trend linesarea_chart— filled trend chart (optionally stacked)bar_chart— categorical comparisonsdata_table— structured rows + columnstimeline— chronological eventsstatus_list— health/status indicators
Charts are interactive in the Control UI (tooltips, legend hover focus, crosshair cursors).
How it works (under the hood)
- The agent calls ui_registry_list or ui_registry_get to discover component schemas.
- The agent calls ui_present with a component ID + props + required
textFallback. - The gateway passes the UI payload to the Control UI if
dynamicUiEnabledis true. - The Control UI validates the component ID and renders the matching React component from the local registry.
- Non‑UI clients ignore the UI payload and display
textFallback.
This keeps UI layout and rendering under client control while still letting agents present rich data.
Recommended tool flow
- Discover components:
- Inspect a component schema:
- Render it with
ui_present:
Layout hints
You can pass optional layout hints to organize multiple components:
Supported layout types:
stack(vertical)row(horizontal)grid(columns)
Unknown layout fields are ignored by the client.
Example: agent health dashboard
Combine a status list + charts in a grid layout:
Best practices
- Always provide a clear
textFallbackfor non-UI clients. - Keep arrays small (charts and lists should stay concise).
- Use stable labels so users can compare across updates.
- Include units in values or labels (ms, %, $, req/s).
- Use
uiOnly: trueonly when the UI is the primary response.
Extend the registry (add your own components)
Dynamic UI is registry‑driven. To add a new component, you update both the registry metadata and the Control UI implementation.
1) Add metadata to the registry
Edit the registry file:
Add a new component entry with a schema and example:
Create the matching example file at:
2) Implement the UI component
Add the React component in the Control UI and register it:
Register it by ID:
3) Rebuild + use it
Rebuild the web UI after adding components so the registry is available at runtime.
Notes
- Agents can only render components that exist in the Control UI registry.
textFallbackis mandatory for everyui_presentcall.- Keep schemas small and props stable so agents can reason about them reliably.
Troubleshooting
- UI not rendering: check
gateway.dynamicUiEnabled. - Unknown component: call
ui_registry_listto verify IDs. - Schema errors: use
ui_registry_getto confirm required props.
