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.

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

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

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

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)

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