Overview
The Control Plane is a FastAPI-based REST API server that orchestrates your entire Kubiya infrastructure. Key Responsibilities:- Manages agent lifecycle and configuration
- Integrates with Temporal for workflow orchestration
- Handles teams, projects, environments, and policies
- Streams real-time execution events via WebSocket
- Routes tasks to appropriate queues and workers
Quick Start
1
Create Database
2
Configure Connection
3
Start Server
4
Verify
http://localhost:7777/api/docs for interactive API documentation.Prerequisites
System Requirements
- Python 3.10+ (NOT 3.8+)
- PostgreSQL 13+ (required)
- Redis (optional, recommended)
- 2GB RAM minimum (4GB recommended)
Database Setup
- Local PostgreSQL
- Supabase
- AWS RDS
- Google Cloud SQL
Optional: Redis
Configuration
Package Installation
By default, the CLI installs the latest version from PyPI automatically.- PyPI (Default)
- Git Repository
- Local Source
Server Options
Production vs Development
Production vs Development
Development Mode (
--development):- Hot reloading on code changes
- Single worker process
- NOT for production
--workers=N):- Gunicorn with multiple workers
- Better performance and fault tolerance
- Recommended: 4 workers
LiteLLM Gateway
LiteLLM Gateway
Route LLM requests through your own proxy:Benefits: centralized management, cost tracking, rate limiting
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | ✅ | - | PostgreSQL connection string |
API_HOST | ❌ | 0.0.0.0 | Server bind address |
API_PORT | ❌ | 7777 | Server port |
SECRET_KEY | ⚠️ | Auto | JWT secret (set for production!) |
REDIS_URL | ❌ | redis://localhost:6379/0 | Redis connection |
TEMPORAL_HOST | ❌ | localhost:7233 | Temporal server |
LITELLM_API_KEY | ❌ | - | LiteLLM API key |
LITELLM_GATEWAY_URL | ❌ | - | LiteLLM gateway URL |
SUPABASE_URL | ❌ | - | Supabase project URL |
SUPABASE_SERVICE_KEY | ❌ | - | Supabase service key |
Use CLI flags
--workers and --development for worker count and hot reloading.Production Deployment
Docker
- Dockerfile
- Docker Compose
Kubernetes
- Deployment
- Service
- Secrets
Nginx Reverse Proxy
Database Management
Automatic Migrations
Migrations run automatically on startup using Alembic:Backup & Restore
Connection Pooling
Use PgBouncer for production:Monitoring
Health Checks
API Documentation
Once running, access:- Swagger UI:
http://localhost:7777/api/docs - ReDoc:
http://localhost:7777/api/redoc - OpenAPI Spec:
http://localhost:7777/api/openapi.json
Built-in WebUI
Logs
- Local
- Docker
- Kubernetes
Security
Production Checklist
Best Practices
Secret Management
Secret Management
Never use auto-generated keys in production:Never pass secrets via CLI flags (visible in process list)
Database Security
Database Security
Always use SSL/TLS:Grant minimal permissions:
Network Security
Network Security
Bind to localhost for local-only access:Always use reverse proxy for external access with:
- SSL/TLS termination
- Rate limiting
- WAF protection
Troubleshooting
Database Connection Failed
Database Connection Failed
Error:
migration failed: connection refusedSolutions:- Verify PostgreSQL is running:
pg_isready -h localhost -p 5432 - Check DATABASE_URL format:
echo $DATABASE_URL - Test connection:
psql $DATABASE_URL -c "SELECT 1" - Check firewall:
nc -zv postgres-host 5432
Port Already in Use
Port Already in Use
Error:
server did not become healthySolutions:- Find process:
lsof -i:7777 - Kill process:
lsof -ti:7777 | xargs kill - Use different port:
--port=8888
URL Encoding Issues
URL Encoding Issues
Error: Or use Python:
could not translate host nameCause: Special characters in password not encodedSolution: Encode special characters:!→%21,@→%40,#→%23,$→%24,%→%25
python3 -c "from urllib.parse import quote; print(quote('pass!word'))"Import Errors
Import Errors
Error:
ModuleNotFoundErrorSolutions:- Reinstall:
kubiya control-plane start --no-cache - Specific version:
kubiya control-plane start --package-version=0.6.0 --no-cache - Use Git:
--package-source=git+https://github.com/kubiyabot/control-plane-api.git@main
SECRET_KEY Warning
SECRET_KEY Warning
Warning:
Using auto-generated SECRET_KEY (not suitable for production)Solution: