Recipe Serve Advanced Features
This guide covers advanced server features including rate limiting, metrics, admin endpoints, workers, and OpenTelemetry tracing.Rate Limiting
Protect your server from abuse with configurable rate limiting.Configuration
Rate Limiter Class
Response Format
When rate limited, clients receive:Retry-After: <seconds>
Request Size Limits
Prevent oversized payloads from overwhelming your server.Configuration
Response Format
When request is too large:Metrics Endpoint
Expose Prometheus-format metrics for monitoring.Enable Metrics
Metrics Format
Using with Prometheus
Admin Reload Endpoint
Hot-reload recipes without restarting the server.Enable Admin Endpoints
Reload Recipes
Programmatic Reload
Workers (Multi-Process)
Scale with multiple worker processes.Configuration
Notes
- Workers > 1 automatically disables hot reload
- Each worker has its own rate limiter state (use Redis for distributed limiting)
- Recommended: 2 * CPU cores + 1
OpenTelemetry Tracing
Distributed tracing with OpenTelemetry.Configuration
Supported Exporters
| Exporter | Config Key | Default Endpoint |
|---|---|---|
| OTLP | otlp_endpoint | http://localhost:4317 |
| Jaeger | jaeger_host, jaeger_port | localhost:6831 |
| Zipkin | zipkin_endpoint | http://localhost:9411/api/v2/spans |
Install Dependencies
Lazy Import
OpenTelemetry dependencies are lazily imported. If not installed, a warning is logged but the server continues to work.OpenAPI Specification
Get the OpenAPI spec for your server.Endpoint
Response
Template Search Paths
Configure where recipes are discovered.Search Order
PRAISONAI_RECIPE_PATHenvironment variable./recipesin current directory~/.praison/recipesin home directory- Agent-Recipes package (if installed)
- Built-in templates
Get Search Paths
Custom Path
Complete Example
Configuration Reference
| Key | Type | Default | Description |
|---|---|---|---|
rate_limit | int | 0 (disabled) | Requests per minute per client |
rate_limit_exempt_paths | list | ["/health", "/metrics"] | Paths exempt from rate limiting |
max_request_size | int | 10485760 (10MB) | Maximum request body size |
enable_metrics | bool | false | Enable /metrics endpoint |
enable_admin | bool | false | Enable /admin/* endpoints |
trace_exporter | str | ”none” | Tracing exporter (none, otlp, jaeger, zipkin) |
otlp_endpoint | str | ”http://localhost:4317” | OTLP collector endpoint |
service_name | str | ”praisonai-recipe” | Service name for tracing |
Next Steps
- See CLI Usage for command-line options
- Review Recipe Serve Basics
- Explore Endpoints

