How It Works
Quick Start
Choose a pattern
| Pattern | Best for |
|---|---|
| B — In-Process Host | Single Python app, embedded UI |
| C — Integrated Gateway | One port for UI + REST + WebSocket |
| D — Platform API | PraisonAI Cloud (planned) |
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
| Feature | Pattern B | Pattern C | Pattern D |
|---|---|---|---|
| Complexity | Low | Medium | High |
| Setup Time | Minutes | Minutes | TBD |
| Scalability | Application-bound | Single-process | Cloud-scale |
| Real-time | Via callbacks | WebSocket | Platform streams |
| Deployment | Embedded | Standalone | Distributed |
| Use Cases | Apps, Prototypes | Gateways, APIs | Enterprise, SaaS |
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

