How It Works
Quick Start
1
Simple Usage
Enable rate limiting and metrics on an existing server:Scrape metrics at
GET /metrics (Prometheus format).2
With Configuration
Production setup with auth, admin reload, workers, and tracing:
How It Works
Advanced features layer onto the base recipe server from Recipe Serve. Rate limiting uses a sliding window per client; metrics expose request counts and latency; admin endpoints hot-reload recipes without restart.Configuration Options
Common Patterns
Programmatic rate limiter
Admin reload
Prometheus scrape config
OpenTelemetry dependencies
Best Practices
Always enable auth with admin endpoints
Always enable auth with admin endpoints
Set
enable_admin=True only alongside auth: api-key and load the key from PRAISONAI_API_KEY. Admin reload can change live behaviour — protect it.Use workers for CPU-bound recipe loads
Use workers for CPU-bound recipe loads
Set
workers to roughly 2 × CPU cores + 1. Workers above 1 disable hot reload automatically.Exempt health and metrics from rate limits
Exempt health and metrics from rate limits
Keep
/health and /metrics in rate_limit_exempt_paths so orchestrators and Prometheus can poll without consuming quota.Use Redis for distributed rate limiting
Use Redis for distributed rate limiting
The built-in limiter is in-memory per worker. For multi-node deployments, place a shared rate limiter in front of the service (API gateway or Redis-backed middleware).
Related
Recipe Serve
Programmatic server configuration and deployment
Endpoints Code
Client-side code for calling recipe endpoints

