UIPreset packages every UI knob into one object so build_ui_app(preset) returns a ready-to-serve app.
Quick Start
1
Chat UI in three lines
Start with an agent, wire it through
agent_kwargs, and serve:2
Custom agent factory
Use
agent_factory when each session needs a fresh agent:UIPreset Fields
Default App Patterns
All five bundled UI apps now usebuild_ui_app(UIPreset(...)):
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

