loader
AI Agent Configuration Loader for PraisonAI Agents. Loads configuration from multiple sources with precedence:- Explicit parameters (highest)
- Environment variables
- Config file (.praisonai/config.toml or praisonai.toml)
- Defaults (lowest)
- Config is loaded lazily on first access
- No file I/O at import time
- Cached after first load
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
| Name | Value |
|---|---|
VALID_PLUGINS_KEYS | {'enabled': (bool, list, str), 'auto_discover': (bool,), 'directories': (list,)} |
VALID_DEFAULTS_KEYS | {'model': (str,), 'base_url': (str,), 'api_key': (str,), 'allow_delegation': (bool,), 'allow_code_execution': (bool,), 'code_execution_mode': (str,), 'memory': (dict, bool), 'knowledge': (dict, bool),... |
VALID_ROOT_KEYS | {'plugins', 'defaults'} |

