Skip to main content
Integrate PraisonAI agents directly into your application using the built-in host integration module.
Just want a UI quickly? Use UIPreset + build_ui_app() — see UI Presets.
The user interacts through the host app; PraisonAIUI bridges agent output into the host UI.

How It Works

Quick Start

1

Simple Host

Create a host app with default settings:
2

Advanced Configuration

Configure with custom agents and settings:

When to Use build_host_app vs build_ui_app

Both APIs remain supported. Choose based on how much control you need:

Integration Patterns

Choose your integration pattern based on your needs:

Configuration Options


API Reference

Core Functions

Apply host settings and wire backends. Must be called before create_host_app().
Return the Starlette app instance. Call after configure_host().
One-shot configuration and app creation. Simplest approach.
Pattern C: Start gateway with integrated UI on single port. Sync wrapper for CLI and scripts.
For async usage, use the async variant:

Legacy Mode

Set PRAISONAI_HOST_LEGACY=1 to use callback-only mode without provider wiring. This skips automatic backend integration.
In legacy mode, only @aiui.reply callbacks work - no automatic agent integration.

Common Patterns

Pattern B: In-Process Host

Embed the UI in your existing application:

Pattern C via CLI

Use the integrated UI-Gateway command for quick setup:

Pattern C: Integrated Gateway

Single process serving UI + API + WebSocket:

Custom Bridges

Wire your own backend services:
Bridge failures are now logged as warnings for non-ImportError exceptions (previously debug level). This improves visibility when optional services fail to initialize.

Best Practices

Use environment variables for configuration that changes between deployments:
Handle import errors gracefully for optional features:
Use context managers for proper cleanup in long-running applications:

Integration Patterns

Compare Pattern B vs C vs D

Backend Injection

Custom backend services