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.- Single application deployment
- Direct Python integration needed
- Simple agent interactions
- Development and testing
- 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.- Need unified endpoint for UI + API
- WebSocket real-time communication required
- Single-port deployment constraints
- Container deployment scenarios
- 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
- 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
- Development
- Production
Migration Path
Moving between patterns as your needs evolve:Best Practices
Start with Pattern B for prototypes
Start with Pattern B for prototypes
Embed
build_host_app() in your existing FastAPI or Flask app — fastest path to a working agent UI without extra infrastructure.Move to Pattern C for production gateways
Move to Pattern C for production gateways
When you need WebSocket streaming and a single deployable port, switch to
run_integrated_gateway() with the same agent config.Never hardcode tokens
Never hardcode tokens
Read platform tokens from environment variables in both development and production configs.
Plan a migration path
Plan a migration path
Extract shared agent config into a dict or YAML file so moving from Pattern B → C → D reuses the same definitions.
Related
Host Integration
Implementation details
Channels Gateway
Connect agents to chat platforms
Backend Injection
Custom backend services
Gateway
Multi-channel gateway architecture

