Skip to main content

phi_core/config/
mod.rs

1//! Configuration module — TOML/JSON/YAML config → Agent construction pipeline.
2//!
3//! # Overview
4//!
5//! This module provides a declarative configuration system for building agents:
6//!
7//! 1. **Schema** ([`AgentConfig`]) — the deserialization target for config files
8//! 2. **Parser** ([`parse_config`], [`parse_config_file`]) — multi-format parsing with env var substitution
9//! 3. **Builder** ([`agent_from_config`]) — constructs `Arc<dyn Agent>` from parsed config
10//!
11//! # Example
12//!
13//! ```ignore
14//! let config = parse_config_file(Path::new("agent.toml"))?;
15//! let agent = agent_from_config(&config)?;
16//! ```
17
18mod builder;
19mod parser;
20pub mod reference;
21mod schema;
22
23pub use builder::{
24    agent_from_config, agent_from_config_with_registry, agents_from_config, ConfigError,
25};
26pub use parser::{parse_config, parse_config_auto, parse_config_file, ConfigFormat};
27pub use reference::{parse_config_ref, ConfigRef};
28pub use schema::{
29    AgentConfig, AgentInstanceSection, AgentSection, CacheSection, CallbacksSection,
30    CompactionInstanceSection, CompactionSection, CompatSection, CostSection, ExecutionSection,
31    HooksSection, ProfileInstanceSection, ProfileSection, PromptInstanceSection, ProviderInstance,
32    ProviderSection, RetrySection, SessionSection, SkillsSection, StrategyBlockSection,
33    StrategyInstanceSection, SubAgentsSection, SystemPromptSection, SystemPromptStrategySection,
34    ToolInstance, ToolsSection,
35};