Skip to main content

Internal Defaults

Magic numbers and hardcoded constants are centralized in a single module — agent_actions/config/defaults.py — so every consumer references a named constant instead of a bare literal. This makes defaults discoverable, documented, and changeable in one place.

Design​

The module contains plain classes with class attributes grouped by domain. It has zero imports, which means it can be safely imported from anywhere in the codebase without circular-dependency risk.

python
PY
from agent_actions.config.defaults import OllamaDefaults

base_url = os.getenv("OLLAMA_HOST", OllamaDefaults.BASE_URL)

Domains​

StorageDefaults​

ConstantTypeValueDescription
SQLITE_LOCK_TIMEOUT_SECONDSfloat30.0Wait time for SQLite database locks
PROMPT_TRACE_RETENTION_RUNSint10Number of workflow runs to retain prompt traces before cleanup
SOURCE_DATA_TTL_DAYSint|NoneNoneDays to retain source data; None means keep forever

LockDefaults​

File-lock timeouts are split intentionally: simple (shared/read) locks use a shorter timeout than atomic (exclusive read-modify-write) locks.

ConstantTypeValueDescription
SIMPLE_LOCK_TIMEOUT_SECONDSfloat5.0Timeout for shared/read file locks
ATOMIC_LOCK_TIMEOUT_SECONDSfloat10.0Timeout for exclusive read-modify-write locks

OllamaDefaults​

ConstantTypeValueDescription
BASE_URLstrhttp://localhost:11434Default Ollama server URL
BATCH_MAX_WORKERSint1Maximum concurrent workers for Ollama batch processing

This value was previously duplicated in three files. It can be overridden at runtime via the OLLAMA_HOST environment variable.

OllamaCloudDefaults​

ConstantTypeValueDescription
BASE_URLstrhttps://ollama.comDefault Ollama Cloud API URL
BATCH_MAX_WORKERSint1Maximum concurrent workers for Ollama Cloud batch processing

ApiDefaults​

ConstantTypeValueDescription
MAX_RESPONSE_BYTESint10 * 1024 * 1024Safety cap on API response size (10 MB)
REQUEST_TIMEOUT_SECONDSint30HTTP request timeout for data-source fetching

SeedDataDefaults​

ConstantTypeValueDescription
MAX_FILE_SIZE_BYTESint10 * 1024 * 1024Maximum seed/static data file size (10 MB)

PromptDefaults​

ConstantTypeValueDescription
MAX_PROMPT_SIZE_BYTESint100 * 1024Maximum prompt file size for validation (100 KB)

DocsDefaults​

ConstantTypeValueDescription
README_MAX_BYTESint100 * 1024Maximum README content included in catalog.json (100 KB)
EVENT_TAIL_LIMITint2000Most recent events each log keeps for catalog.json; every log shares one window of this size
EVENT_PROBLEM_LIMITint500Kept per level, per log, on top of the recency window — so a log retains up to 500 warnings and 500 errors, and rare old problems still reach the window

Naming Conventions​

  • _SECONDS / _BYTES suffixes make units explicit
  • Constants use UPPER_SNAKE_CASE
  • Classes group related defaults by subsystem

Adding New Defaults​

  1. Add a constant to the appropriate class (or create a new class if the domain is new)
  2. Keep the module free of imports
  3. Update the consumer to reference the constant
  4. Update this page

See Also​