agentconnect.config.loaders module

Configuration loaders for AgentConnect.

This module implements the three-tier configuration precedence system: 1. Runtime kwargs (highest priority) 2. agentconnect.yaml file 3. Hard-coded defaults (lowest priority)

The loader automatically discovers and loads agentconnect.yaml from the project root or current working directory and merges it with optional runtime overrides. It does not read environment variables for general configuration. Environment variables are reserved for secrets and are consumed directly by the specific subsystems that require them (e.g., provider SDKs, external clients).

load_settings(**overrides)

Load AgentConnect configuration with three-tier precedence.

Precedence (highest to lowest): 1. Runtime overrides (kwargs) 2. agentconnect.yaml file 3. Hard-coded defaults

Parameters:

**overrides – Runtime configuration overrides

Return type:

AgentConnectSettings

Returns:

Fully configured AgentConnectSettings instance

Example

# Load with defaults
settings = load_settings()

# Override specific settings at runtime
settings = load_settings(
    registry={'vector_search': {'deployment': {'type': 'in_memory'}}},
)
create_example_config()

Create an example agentconnect.yaml configuration file content.

Return type:

str

Returns:

YAML configuration string with examples and comments

save_example_config(path=None)

Save an example configuration file to disk.

Parameters:

path (Optional[Path]) – Where to save the file. Defaults to agentconnect.yaml in current directory.

Return type:

Path

Returns:

Path where the file was saved

validate_config_file(path)

Validate a configuration file.

Parameters:

path (Path) – Path to the configuration file

Return type:

bool

Returns:

True if valid, False otherwise