Skip to main content

loader

AI Agent Configuration Loader for PraisonAI Agents. Loads configuration from multiple sources with precedence:
  1. Explicit parameters (highest)
  2. Environment variables
  3. Config file (.praisonai/config.toml or praisonai.toml)
  4. Defaults (lowest)
Zero Performance Impact:
  • Config is loaded lazily on first access
  • No file I/O at import time
  • Cached after first load
Usage: from praisonaiagents.config.loader import get_config, get_default

Get entire config

config = get_config()

Get specific default with fallback

model = get_default(“model”, “gpt-4o-mini”) memory_config = get_default(“memory”, {})

Validate config file

errors = validate_config(config.to_dict())

Import

Classes

ConfigValidationError

Raised when config file has validation errors.

PluginsConfig

Configuration for the plugin system.

DefaultsConfig

Default configuration for Agent parameters.

PraisonConfig

Root configuration for PraisonAI Agents.

Functions

get_config()

Get the global configuration.

get_plugins_config()

Get plugins configuration.

get_defaults_config()

Get defaults configuration.

get_default()

Get a specific default value.

is_plugins_enabled()

Check if plugins are enabled via config or env var.

get_enabled_plugins()

Get list of enabled plugins (if specific list provided).

clear_config_cache()

Clear the config cache (for testing).

validate_config()

Validate config file structure and types.

get_config_path()

Get the path to the config file if it exists.

apply_config_defaults()

Apply config defaults to a parameter if not explicitly set.

Constants