Skip to main content
The user describes how PraisonAI should run in their stack; you pick in-process, gateway, or platform API pattern. PraisonAI supports three integration patterns for different deployment scenarios.

How It Works

Quick Start

1

Choose a pattern

2

Pattern B — embed in your app

3

Pattern C — unified gateway


Pattern Decision Guide

Pattern B: In-Process Host

Embed PraisonAIUI directly in your Python application.
When to Use:
  • Single application deployment
  • Direct Python integration needed
  • Simple agent interactions
  • Development and testing
When NOT to Use:
  • Need separate UI and API processes
  • Complex microservice architecture
  • High-scale production deployments

Pattern C: Integrated Gateway

Single process serving UI, REST API, and WebSocket on one port.
Or via CLI:
When to Use:
  • Need unified endpoint for UI + API
  • WebSocket real-time communication required
  • Single-port deployment constraints
  • Container deployment scenarios
When NOT to Use:
  • Want separate scaling of UI vs API
  • Complex routing requirements
  • Need multiple protocol support

Pattern D: Platform API

Deferred (P3) - Connect to PraisonAI Cloud via Platform Client
Connect PraisonAIUI to PraisonAI Cloud for managed agents.
When Available:
  • Cloud-managed agent infrastructure
  • Multi-tenant deployments
  • Enterprise security requirements
  • Global agent orchestration

Comparison Matrix


Pattern Examples

FastAPI Integration (Pattern B)

Container Deployment (Pattern C)

Development vs Production


Migration Path

Moving between patterns as your needs evolve:

Best Practices

Embed build_host_app() in your existing FastAPI or Flask app — fastest path to a working agent UI without extra infrastructure.
When you need WebSocket streaming and a single deployable port, switch to run_integrated_gateway() with the same agent config.
Read platform tokens from environment variables in both development and production configs.
Extract shared agent config into a dict or YAML file so moving from Pattern B → C → D reuses the same definitions.

Host Integration

Implementation details

Channels Gateway

Connect agents to chat platforms

Backend Injection

Custom backend services

Gateway

Multi-channel gateway architecture