> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# loader • AI Agent SDK

> Configuration Loader for PraisonAI Agents.

# loader

<Badge color="blue">AI Agent</Badge>

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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.config import loader
```

## Classes

<CardGroup cols={2}>
  <Card title="ConfigValidationError" icon="brackets-curly" href="../classes/ConfigValidationError">
    Raised when config file has validation errors.
  </Card>

  <Card title="PluginsConfig" icon="brackets-curly" href="../classes/PluginsConfig">
    Configuration for the plugin system.
  </Card>

  <Card title="DefaultsConfig" icon="brackets-curly" href="../classes/DefaultsConfig">
    Default configuration for Agent parameters.
  </Card>

  <Card title="PraisonConfig" icon="brackets-curly" href="../classes/PraisonConfig">
    Root configuration for PraisonAI Agents.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="get_config()" icon="function" href="../functions/get_config">
    Get the global configuration.
  </Card>

  <Card title="get_plugins_config()" icon="function" href="../functions/get_plugins_config">
    Get plugins configuration.
  </Card>

  <Card title="get_defaults_config()" icon="function" href="../functions/get_defaults_config">
    Get defaults configuration.
  </Card>

  <Card title="get_default()" icon="function" href="../functions/get_default">
    Get a specific default value.
  </Card>

  <Card title="is_plugins_enabled()" icon="function" href="../functions/is_plugins_enabled">
    Check if plugins are enabled via config or env var.
  </Card>

  <Card title="get_enabled_plugins()" icon="function" href="../functions/get_enabled_plugins">
    Get list of enabled plugins (if specific list provided).
  </Card>

  <Card title="clear_config_cache()" icon="function" href="../functions/clear_config_cache">
    Clear the config cache (for testing).
  </Card>

  <Card title="validate_config()" icon="function" href="../functions/validate_config">
    Validate config file structure and types.
  </Card>

  <Card title="get_config_path()" icon="function" href="../functions/get_config_path">
    Get the path to the config file if it exists.
  </Card>

  <Card title="apply_config_defaults()" icon="function" href="../functions/apply_config_defaults">
    Apply config defaults to a parameter if not explicitly set.
  </Card>
</CardGroup>

### 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'}`                                                                                                                                                                                     |
