""" @config SwarmConfig (swarm/config.py) @purpose Central configuration for Swarm Intelligence Engine. """ import os from pathlib import Path from dotenv import load_dotenv from pydantic import BaseModel _backend_env = Path(__file__).resolve().parent.parent / ".env" if _backend_env.exists(): load_dotenv(_backend_env) else: load_dotenv() class SwarmSettings(BaseModel): # Execution & Concurrency MAX_CONCURRENT_SIMULATIONS: int = 2 JOB_TIMEOUT_SECONDS: int = 120 HEARTBEAT_TIMEOUT_SECONDS: int = 60 ZOMBIE_REAP_MINUTES: int = 3 # Default Provider: "mock", "gemini", or "openai" DEFAULT_PROVIDER: str = os.getenv("SWARM_LLM_PROVIDER", "gemini" if os.getenv("GEMINI_API_KEY") else "mock") # API Keys GEMINI_API_KEY: str = os.getenv("GEMINI_API_KEY", "") OPENAI_API_KEY: str = os.getenv("OPENAI_API_KEY", "") OPENAI_BASE_URL: str = os.getenv("OPENAI_BASE_URL", "https://api.openai.com/v1") # Models GEMINI_MODEL: str = os.getenv("GEMINI_MODEL", "gemini-3.1-flash-lite") OPENAI_MODEL: str = os.getenv("OPENAI_MODEL", "gpt-4o-mini") # Token Pricing Matrices (USD per 1,000,000 tokens) PRICING_MATRIX: dict = { "gemini-3.1-flash-lite": {"input_per_million": 0.075, "output_per_million": 0.30}, "gemini-2.0-flash": {"input_per_million": 0.10, "output_per_million": 0.40}, "gpt-4o-mini": {"input_per_million": 0.15, "output_per_million": 0.60}, "mock": {"input_per_million": 0.0, "output_per_million": 0.0}, } # Archetype Parameters DEFAULT_AGENT_COUNT: int = 50 EPISTEMIC_DISCLAIMER: str = ( "Simulated customer behavior represents an exploratory AI hypothesis calibrated against historical " "store observations. Agent-to-agent variance reflects model sensitivity and hypothesis dispersion—it " "does not constitute guaranteed real-world customer behavior." ) swarm_settings = SwarmSettings()