"""backend/core/config.py — All non-secret config lives here. Secrets come from .env.""" from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", extra="ignore", case_sensitive=False) # ── Secrets (from .env) ─────────────────────────────────────────────────── google_api_key: str = "" groq_api_key: str = "" serper_api_key: str = "" # ── App ─────────────────────────────────────────────────────────────────── app_env: str = "development" app_host: str = "0.0.0.0" app_port: int = 8000 log_level: str = "INFO" frontend_url: str = "http://localhost:5500" # ── Database ────────────────────────────────────────────────────────────── database_url: str = "sqlite+aiosqlite:///./agent_system.db" # ── Redis ───────────────────────────────────────────────────────────────── redis_host: str = "localhost" redis_port: int = 6379 redis_db: int = 0 redis_url: str = "redis://localhost:6379" redis_ttl: int = 86400 # ── LLM provider: "gemini" or "groq" ───────────────────────────────────── llm_provider: str = "groq" # Gemini models planner_model: str = "gemini-2.5-flash" executor_model: str = "gemini-2.5-flash" critic_model: str = "gemini-2.5-flash" memory_model: str = "gemini-2.5-flash" # Groq models groq_planner_model: str = "llama-3.3-70b-versatile" groq_executor_model: str = "llama-3.3-70b-versatile" groq_critic_model: str = "llama-3.1-8b-instant" groq_memory_model: str = "llama-3.1-8b-instant" # ── Agent behaviour ─────────────────────────────────────────────────────── max_iterations: int = 3 max_retries: int = 1 step_timeout: int = 60 enable_reflection: bool = True enable_memory: bool = True max_plan_steps: int = 4 max_output_tokens: int = 512 @property def is_dev(self) -> bool: return self.app_env == "development" @lru_cache(maxsize=1) def get_settings() -> Settings: return Settings()