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
configure_host()
configure_host()
Apply host settings and wire backends. Must be called before
create_host_app().create_host_app()
create_host_app()
Return the Starlette app instance. Call after
configure_host().build_host_app()
build_host_app()
One-shot configuration and app creation. Simplest approach.
run_integrated_gateway()
run_integrated_gateway()
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
@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
Environment Configuration
Environment Configuration
Use environment variables for configuration that changes between deployments:
Error Handling
Error Handling
Handle import errors gracefully for optional features:
Resource Cleanup
Resource Cleanup
Use context managers for proper cleanup in long-running applications:
Related
Integration Patterns
Compare Pattern B vs C vs D
Backend Injection
Custom backend services

