Files
agenticSystem/src/config.py
2026-04-01 23:16:45 +01:00

62 lines
1.7 KiB
Python

"""Application configuration via environment variables."""
from __future__ import annotations
from pydantic_settings import BaseSettings
from pydantic import Field
class Settings(BaseSettings):
# --- Service ---
service_name: str = "agentic-microservice"
service_version: str = "1.0.0"
host: str = "0.0.0.0"
port: int = 8000
debug: bool = False
# --- Redis ---
redis_host: str = "localhost"
redis_port: int = 6379
redis_db: int = 0
redis_password: str = ""
redis_key_prefix: str = "agentic"
session_ttl_seconds: int = 86400 # 24h
@property
def redis_url(self) -> str:
auth = f":{self.redis_password}@" if self.redis_password else ""
return f"redis://{auth}{self.redis_host}:{self.redis_port}/{self.redis_db}"
# --- Model providers ---
anthropic_api_key: str = ""
openai_api_key: str = ""
default_model_provider: str = "claude"
default_model_id: str = "claude-sonnet-4-20250514"
max_tokens: int = 4096
temperature: float = 0.3
# --- Context engine ---
context_max_tokens: int = 120_000
compaction_threshold_tokens: int = 80_000
artifact_summary_max_chars: int = 2000
working_context_max_items: int = 20
# --- MCP ---
mcp_server_command: str = ""
mcp_server_args: list[str] = Field(default_factory=list)
mcp_timeout_seconds: float = 30.0
mcp_startup_timeout_seconds: float = 10.0
# --- Orchestrator ---
max_execution_steps: int = 25
subagent_max_steps: int = 10
max_execution_timeout_seconds: float = 300.0 # 5 min global timeout
# --- SSE ---
sse_keepalive_seconds: float = 15.0
model_config = {"env_prefix": "AGENTIC_", "env_file": ".env", "extra": "ignore"}
settings = Settings()