Skip to main content

Overview

The Config Loader reads agent-orchestrator.yaml, validates it with Zod schemas, applies defaults, and expands paths. It provides a type-safe configuration object for the entire orchestrator. Key features:
  • Auto-discovery of config files (searches up directory tree like git)
  • Zod validation with helpful error messages
  • Automatic defaults for all optional fields
  • Path expansion (~ to home directory)
  • Project uniqueness validation
  • Default reaction configuration
The config loader follows a search order similar to git: check AO_CONFIG_PATH env var, search up from CWD, check home directory locations.

Usage

Functions

loadConfig

Load and validate configuration from a YAML file.
string
Explicit path to config file. If omitted, searches standard locations.
Returns:
object
Validated and normalized configuration object.
Throws:
  • Error("No agent-orchestrator.yaml found") - No config file found in search locations
  • ZodError - Config validation failed
Example:

loadConfigWithPath

Load config and return both the config object and resolved file path.
string
Explicit path to config file. If omitted, searches standard locations.
Returns:
OrchestratorConfig
Validated configuration object.
string
Absolute path to the loaded config file.
Example:

findConfig

Find the config file path without loading it.
string
Directory to start searching from. Defaults to CWD.
Returns:
string
Absolute path to config file, or null if not found.
Example:

validateConfig

Validate a raw config object without loading from file.
unknown
required
Raw config object (from YAML parse, JSON, etc.).
Returns:
object
Validated and normalized configuration.
Example:

getDefaultConfig

Get a default config object (useful for ao init).
Returns:
object
Config with all defaults and empty projects.
Example:

Config Search Order

The config loader searches these locations in order:
  1. AO_CONFIG_PATH environment variable (if set)
  2. Search up directory tree from CWD (like git)
  3. Explicit startDir parameter (if provided)
  4. Home directory locations
    • ~/.agent-orchestrator.yaml
    • ~/.agent-orchestrator.yml
    • ~/.config/agent-orchestrator/config.yaml
Both .yaml and .yml extensions are supported. The loader tries .yaml first, then .yml.

Configuration Schema

Top-Level Config

Example:

DefaultPlugins

ProjectConfig

Example:

ReactionConfig

Example:

TrackerConfig

Example:

NotifierConfig

Example:

Validation

The config loader performs extensive validation:

1. Schema Validation (Zod)

Example error:

2. Project Uniqueness

Prevents duplicate project IDs (directory basenames):
Example:

3. Session Prefix Collisions

Prevents duplicate session prefixes:
Fix:

Defaults

The config loader applies intelligent defaults:

1. Plugin Defaults

2. Project Defaults

3. Notification Routing Defaults

4. Reaction Defaults

See Reaction System for default reactions.

Path Expansion

All path fields are expanded:
Example:

Minimal Config

You only need to specify projects - everything else has defaults:
This expands to:

Complete Example

See Also