UIPreset packages every UI knob into one object so build_ui_app(preset) returns a ready-to-serve app.
Quick Start
UIPreset Fields
| Field | Type | Default | Description |
|---|---|---|---|
title | str | "PraisonAI" | Browser tab and header title |
logo | str | "🤖" | Logo emoji or text in the sidebar |
pages | List[str] | ["chat"] | Enabled UI pages (chat, agents, sessions, …) |
theme | Dict | blue preset, dark mode | Theme dict passed to configure_host |
agent_kwargs | Dict | {} | Keyword args for default Agent(...) |
starters | List[Dict] | [] | Conversation starter chips |
welcome | str | greeting message | Shown on first load via @aiui.welcome |
sidebar | bool | True | Show sidebar navigation |
page_header | bool | True | Show page header bar |
openai_fallback | bool | False | Fall back to OpenAI when agent errors (legacy mode) |
settings_handler | Callable | None | None | Async (new_settings) -> None on settings change |
agent_factory | Callable | None | None | (settings) -> Agent for per-session agents |
realtime_manager | Any | None | None | OpenAI realtime manager instance |
agent_loader | Callable | None | None | Load agents from YAML at startup |
Default App Patterns
All five bundled UI apps now usebuild_ui_app(UIPreset(...)):
| App | Module | Typical pages |
|---|---|---|
| Agents UI | ui_agents/default_app.py | chat, agents, sessions |
| Bot UI | ui_bot/default_app.py | chat |
| Chat UI | ui_chat/default_app.py | chat |
| Dashboard UI | ui_dashboard/default_app.py | chat, usage, sessions |
| Realtime UI | ui_realtime/default_app.py | chat (with realtime manager) |
Legacy Host Mode
SetPRAISONAI_HOST_LEGACY=1 to enable callback-only handlers inside build_ui_app (@aiui.reply, @aiui.settings, @aiui.cancel).
When openai_fallback=True (legacy mode only):
- Requires
OPENAI_API_KEYin the environment - Model from
PRAISONAI_MODELor defaults togpt-4o-mini - Activates only after the primary agent raises an error
Callable Signatures
Request Flow
Best Practices
Prefer agent_kwargs for static agents
Prefer agent_kwargs for static agents
When every session shares the same agent config,
agent_kwargs is simpler than agent_factory.Use agent_factory for per-user settings
Use agent_factory for per-user settings
When the UI settings panel changes model or instructions,
agent_factory(settings) builds the right agent per session.Keep openai_fallback off in production
Keep openai_fallback off in production
Rely on your configured agent and LLM keys; enable fallback only for demos or legacy migrations.
Related
Host Integration
Full
configure_host / build_host_app APIAIUI Backends
Backend options for PraisonAI UI

