/ .env.agents.example
.env.agents.example
1 # ───────────────────────────────────────────────────────────────────────────── 2 # .env.agents — Multi-agent system configuration 3 # ───────────────────────────────────────────────────────────────────────────── 4 # Controls the autonomous agent system (Monitor, Triage, Developer, QA, 5 # Security, Architect). See docs/06-automation/agent-system.md for details. 6 # Loaded by src/utils/load-env.js (alongside .env and .env.secrets) 7 8 # ─── Core Settings ────────────────────────────────────────────────────────── 9 10 # Enable/disable the multi-agent system (default: false) 11 # Set to 'true' after agent system is tested and ready for production use 12 AGENT_SYSTEM_ENABLED=false 13 14 # ─── Circuit Breaker ──────────────────────────────────────────────────────── 15 16 # Disable agent if failure rate exceeds this threshold 17 # Range: 0.0 to 1.0 (default: 0.3 = 30%) 18 AGENT_CIRCUIT_BREAKER_THRESHOLD=0.3 19 20 # Minutes to wait before auto-recovery after breaker opens 21 # Default: 30 minutes 22 AGENT_CIRCUIT_BREAKER_COOLDOWN=30 23 24 # ─── Rate Limiting & Cost ────────────────────────────────────────────────── 25 26 # Maximum agent task invocations per hour (prevents runaway LLM costs) 27 # Default: 60 (approx 1 per minute) 28 AGENT_MAX_INVOCATIONS_PER_HOUR=60 29 30 # Maximum tasks each agent processes per run cycle 31 # Auto-scales based on queue depth. Default: 5, Max: 20 32 AGENT_MAX_TASKS_PER_CYCLE=5 33 34 # Maximum USD to spend on Claude API calls per day 35 # Emergency shutdown if spending exceeds $5/hour 36 # Default: 10 (USD per day) 37 AGENT_DAILY_BUDGET=10 38 39 # Use Haiku for simple tasks, Sonnet for complex reasoning (default: true) 40 # Haiku is 4x cheaper ($0.80/$4 vs $3/$15 per million tokens) 41 # Simple: Triage, Monitor scans, Security patterns, QA test generation 42 # Complex: Developer bug fixes, Architect design, Security threat modeling 43 AGENT_USE_HAIKU_FOR_SIMPLE_TASKS=true 44 45 # ─── Git Integration ──────────────────────────────────────────────────────── 46 47 # Enable agents to commit changes to git (default: false) 48 # IMPORTANT: Set to 'false' initially, enable only after observing agent behavior 49 AGENT_AUTO_COMMIT=false 50 51 # Branch name for agent commits (default: main) 52 # Set to 'agent/auto' for feature branches, or 'main' for direct commits 53 AGENT_AUTO_COMMIT_BRANCH=main 54 55 # Push agent commits to remote (default: false) 56 # Requires AGENT_AUTO_COMMIT=true. Creates GitHub PRs for mobile review. 57 AGENT_AUTO_PUSH=false 58 59 # ─── Invocation & Scheduling ─────────────────────────────────────────────── 60 61 # Spawn agents immediately when tasks are created (default: true) 62 # When disabled, agents only start on the 5-minute cron polling cycle 63 AGENT_REALTIME_NOTIFICATIONS=true 64 65 # Invoke receiving agent immediately after handoffs (default: true) 66 # Eliminates 5-minute cron delays between workflow steps 67 # Example: Developer → QA handoff completes in <5 seconds instead of 5 minutes 68 AGENT_IMMEDIATE_INVOCATION=true 69 70 # Max consecutive immediate invocations before falling back to cron (default: 10) 71 # Prevents infinite loops. Example chain: Monitor → Triage → Developer → QA (4 deep) 72 AGENT_MAX_CHAIN_DEPTH=10 73 74 # Global spawn rate limit interval in seconds (default: 60) 75 # Enforces max 1 new agent spawn per this interval across all types 76 AGENT_SPAWN_INTERVAL_S=60 77 78 # CPU load threshold above which new agent spawning is throttled (default: 0.7) 79 # Normalised 0.0-1.0. Prevents spawning when system is already busy. 80 AGENT_SPAWN_LOAD_THRESHOLD=0.7 81 82 # ─── Locking & Scaling ───────────────────────────────────────────────────── 83 84 # Minutes before clearing stale locks from crashed agents (default: 2) 85 AGENT_LOCK_STALE_MINUTES=2 86 87 # Enable task-level row locking for horizontal scaling (default: true) 88 # Uses SQLite atomic operations to prevent conflicts 89 AGENT_ENABLE_ROW_LOCKING=true 90 91 # Allow multiple instances of same agent type (default: false) 92 # Requires AGENT_ENABLE_ROW_LOCKING=true. Example: 3 developer agents in parallel. 93 AGENT_ALLOW_HORIZONTAL_SCALING=false 94 95 # Run different agent types simultaneously (default: false) 96 # Parallel is faster but may cause race conditions 97 # Enable only after 2+ weeks of stable sequential operation 98 AGENT_RUN_TYPES_IN_PARALLEL=false 99 100 # ─── Task History & Learning ─────────────────────────────────────────────── 101 102 # Enable task history enrichment for agents to learn from past outcomes (default: true) 103 AGENT_ENABLE_TASK_HISTORY=true 104 105 # ─── Process Reaper ───────────────────────────────────────────────────────── 106 # Kills stale agent processes and warns about resource pressure. 107 # Runs as cron job (2.3 Process Reaper). 108 109 # Max age for background agent processes in minutes (default: 120 = 2 hours) 110 REAPER_MAX_AGENT_AGE_MINUTES=120 111 112 # Zombie process count threshold for warning (default: 500) 113 REAPER_ZOMBIE_WARN_THRESHOLD=500 114 115 # Free memory threshold (MB) for critical warning (default: 1024 = 1GB) 116 REAPER_FREE_MEM_WARN_MB=1024 117 118 # Swap usage threshold (0.0-1.0) for warning (default: 0.7 = 70%) 119 REAPER_SWAP_WARN_PCT=0.7 120 121 # ─── OpenRouter Agent Headers ────────────────────────────────────────────── 122 # HTTP headers sent to OpenRouter API for usage tracking 123 OPENROUTER_REFERER=https://github.com/jasonpaulneu/333Method 124 OPENROUTER_TITLE=333 Method Agent System