Skip to main content
UIPreset packages every UI knob into one object so build_ui_app(preset) returns a ready-to-serve app.
The user opens the preset UI and chats; build_ui_app serves the configured agent instantly.

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 use build_ui_app(UIPreset(...)):

Legacy Host Mode

Set PRAISONAI_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_KEY in the environment
  • Model from PRAISONAI_MODEL or defaults to gpt-4o-mini
  • Activates only after the primary agent raises an error

Callable Signatures


Request Flow


Best Practices

When every session shares the same agent config, agent_kwargs is simpler than agent_factory.
When the UI settings panel changes model or instructions, agent_factory(settings) builds the right agent per session.
Rely on your configured agent and LLM keys; enable fallback only for demos or legacy migrations.

Host Integration

Full configure_host / build_host_app API

AIUI Backends

Backend options for PraisonAI UI