Skip to main content

Configuration Guide

This comprehensive guide covers all OmniDaemon configuration options, from environment variables to production tuning.

Overview

What You’ll Learn:
  • ✅ All environment variables (required & optional)
  • ✅ Event bus configuration (Redis, Kafka, RabbitMQ, NATS)
  • ✅ Storage configuration (JSON, Redis, PostgreSQL, MongoDB)
  • ✅ Agent configuration (SubscriptionConfig)
  • ✅ Performance tuning
  • ✅ Dev/staging/prod configurations
  • ✅ Security best practices
  • ✅ Troubleshooting configuration issues

Environment Variables

Core Configuration

EVENT_BUS_TYPE (Required)

What: Event bus backend type Default: redis_stream Options:
  • redis_stream ✅ Production-ready
  • kafka 🚧 Coming soon
  • rabbitmq 🚧 Coming soon
  • nats 🚧 Coming soon
Example:

STORAGE_BACKEND (Required)

What: Storage backend type Default: json Options:
  • json ✅ Development (file-based)
  • redis ✅ Production (in-memory + persistent)
  • postgresql 🚧 Coming soon
  • mongodb 🚧 Coming soon
Example:

Redis Configuration

REDIS_URL (Required if using Redis)

What: Redis connection URL Format: redis://[username:password@]host:port[/database] Default: redis://localhost:6379 Examples:

REDIS_KEY_PREFIX (Optional)

What: Namespace for Redis keys Default: omni Use case: Multiple OmniDaemon instances on same Redis Example:

JSON Storage Configuration

JSON_STORAGE_DIR (Optional)

What: Directory for JSON files Default: .omnidaemon_data Example:
File Structure:

API Configuration

OMNIDAEMON_API_ENABLED (Optional)

What: Enable HTTP API server Default: false Type: Boolean Example:

OMNIDAEMON_API_PORT (Optional)

What: API server port Default: 8765 Type: Integer Example:

OMNIDAEMON_API_HOST (Optional)

What: API server host Default: 0.0.0.0 (all interfaces) Example:

Logging Configuration

LOG_LEVEL (Optional)

What: Logging verbosity Default: INFO Options: DEBUG, INFO, WARNING, ERROR, CRITICAL Example:
Log Levels:
  • DEBUG: All details (development)
  • INFO: General information (production)
  • WARNING: Warnings only
  • ERROR: Errors only
  • CRITICAL: Critical errors only

Complete .env Examples

Development Configuration

Staging Configuration

Production Configuration


Agent Configuration (SubscriptionConfig)

All Parameters

Parameter Details

consumer_count (Optional)

What: Number of parallel consumers for this agent Default: 1 Range: 1 to 100+ When to increase:
  • ✅ High message volume
  • ✅ Fast processing (< 1 second per message)
  • ✅ Want higher throughput
When to keep low:
  • ✅ Low message volume
  • ✅ Slow processing (> 10 seconds per message)
  • ✅ External rate limits
Examples:
Effect:

reclaim_idle_ms (Optional)

What: How long (milliseconds) before reclaiming a stuck message Default: 180000 (3 minutes) Range: 1000 (1 second) to 3600000 (1 hour) How it works:
  • Message delivered to consumer
  • If not acknowledged within reclaim_idle_ms
  • Message reclaimed by another consumer
When to decrease:
  • ✅ Fast tasks (< 1 minute)
  • ✅ Want quick failure recovery
  • ⚠️ Be careful not to reclaim in-progress tasks!
When to increase:
  • ✅ Slow tasks (> 5 minutes)
  • ✅ External API calls with delays
  • ✅ Avoid premature reclaiming
Examples:
Formula:

dlq_retry_limit (Optional)

What: Max retries before sending to Dead Letter Queue Default: 3 Range: 0 (no retries) to 10+ How it works:
  • Message fails processing
  • Retry #1
  • Retry #2
  • Retry #3
  • After dlq_retry_limit failures → DLQ
When to increase:
  • ✅ Transient errors common (network issues, rate limits)
  • ✅ External services flaky
  • ✅ Safe to retry (idempotent operations)
When to decrease:
  • ✅ Permanent errors (bad data)
  • ✅ Not idempotent (risky to retry)
  • ✅ Want faster DLQ detection
Examples:
Total attempts:

Backend-Specific Configuration

Redis Streams (Event Bus)

Default Configuration (in code):
Tuning: default_maxlen (Stream trimming)
  • Default: 10,000 messages
  • Low traffic: 1,000
  • High traffic: 100,000+
  • Effect: Older messages trimmed automatically
reclaim_interval (How often to check for stuck messages)
  • Default: 30 seconds
  • Fast recovery: 10 seconds
  • Low overhead: 60 seconds
  • Effect: How quickly stuck messages are detected

Redis Storage

Configuration via environment:
Redis Persistence (in redis.conf):
Memory Management:

JSON Storage

Configuration:
File Permissions:
Backup:

Performance Tuning

High Throughput (1000+ messages/second)

Infrastructure:
  • Use Redis with AOF fsync=everysec
  • SSD storage for Redis
  • Sufficient RAM (all data in memory)
  • Multiple agent runner instances

Low Latency (< 100ms per message)

High Availability

Redis Sentinel (automatic failover):
Redis Cluster (horizontal scaling):

Memory Optimization


Security Configuration

Redis Authentication

Redis TLS/SSL

Redis server configuration (redis.conf):

API Security

Environment Variable Security


Configuration Best Practices

1. Environment-Specific Configs

2. Configuration Validation

3. Configuration Documentation

4. Configuration Testing


Troubleshooting Configuration

Redis Connection Issues

Storage Issues

API Not Starting

Environment Variables Not Loading


Further Reading


Summary

Essential Environment Variables:
Key SubscriptionConfig Parameters:
Performance Tuning:
  • High throughput → Increase consumer_count
  • Low latency → Optimize callback, use caching
  • High availability → Multiple runners, Redis Sentinel/Cluster
  • Memory optimization → Clear old data, reduce TTL
Security:
  • Redis password/TLS
  • API behind reverse proxy with HTTPS
  • Secrets management (not .env)
  • Read-only permissions
Best Practices:
  • Environment-specific configs
  • Validate on startup
  • Document in .env.example
  • Test all environments
Configuration is the foundation of production deployment! ⚙️✨