Integrating PraisonAI with PraisonAIUI
Patterns B and C for host bootstrap, backend injection, and modular installs
PraisonAIUI runs standalone or integrated with the PraisonAI wrapper using optional backend injection.
from praisonaiagents import Agent
agent = Agent(
name="Dashboard Assistant",
instructions="Help users from the PraisonAIUI dashboard.",
)
agent.start("Summarise today's agent activity.")The user installs packages, launches praisonai dashboard --aiui, and interacts with the agent in the browser.
Quick Start
- Install
bash pip install praisonai praisonaiui - Run integrated mode
bash praisonai dashboard --aiui
Pattern B — In-process host
from praisonai.integration import build_host_app
app = build_host_app(pages=["chat", "sessions", "workflows"])CLI:
praisonai dashboard --aiuiWires PraisonAISessionDataStore, PraisonAIProvider, and L1 bridges before create_app().
Pattern C — Gateway + static SPA
from praisonai.integration import run_integrated_gateway
import asyncio
asyncio.run(run_integrated_gateway(port=8080))Or AIUIGateway.start() from praisonaiui.integration (calls the same bootstrap).
Legacy rollback
Set PRAISONAI_HOST_LEGACY=1 to skip provider wiring and use callback-only @aiui.reply handlers.
Backend injection
The wrapper calls praisonaiui.backends.set_backend() for hooks, workflows, usage, and approvals. Standalone aiui uses SDK defaults when no backend is injected.
See also: backend-integration in the praisonaiui repo.
Best Practices
Use Pattern B for in-process hosting
Pattern B (in-process host) is simpler to deploy and works well for most use cases.
Use Pattern C for microservices
Pattern C (Gateway + static SPA) scales better and enables independent UI and backend deployments.
Configure allowed origins
Always configure allowed_origins when deploying to non-localhost to prevent unauthorized access.
Use the onboarding wizard
Run praisonai onboard for guided setup — it handles credentials, ports, and daemon configuration.