Overview
The Config Loader readsagent-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.
object
Validated and normalized configuration object.
Error("No agent-orchestrator.yaml found")- No config file found in search locationsZodError- Config validation failed
loadConfigWithPath
Load config and return both the config object and resolved file path.string
Explicit path to config file. If omitted, searches standard locations.
OrchestratorConfig
Validated configuration object.
string
Absolute path to the loaded config file.
findConfig
Find the config file path without loading it.string
Directory to start searching from. Defaults to CWD.
string
Absolute path to config file, or null if not found.
validateConfig
Validate a raw config object without loading from file.unknown
required
Raw config object (from YAML parse, JSON, etc.).
object
Validated and normalized configuration.
getDefaultConfig
Get a default config object (useful forao init).
object
Config with all defaults and empty projects.
Config Search Order
The config loader searches these locations in order:-
AO_CONFIG_PATHenvironment variable (if set) -
Search up directory tree from CWD (like git)
-
Explicit
startDirparameter (if provided) -
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
DefaultPlugins
ProjectConfig
ReactionConfig
TrackerConfig
NotifierConfig
Validation
The config loader performs extensive validation:1. Schema Validation (Zod)
2. Project Uniqueness
Prevents duplicate project IDs (directory basenames):3. Session Prefix Collisions
Prevents duplicate session prefixes: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:Minimal Config
You only need to specify projects - everything else has defaults:Complete Example
See Also
- Lifecycle Manager - Uses config for reactions and notification routing
- Session Manager - Uses config for project and plugin resolution
- Plugin Registry - Loads plugins based on config
