Skip to main content

Module config

Module config 

Source
Expand description

Configuration module — TOML/JSON/YAML config → Agent construction pipeline.

§Overview

This module provides a declarative configuration system for building agents:

  1. Schema (AgentConfig) — the deserialization target for config files
  2. Parser (parse_config, parse_config_file) — multi-format parsing with env var substitution
  3. Builder (agent_from_config) — constructs Arc<dyn Agent> from parsed config

§Example

let config = parse_config_file(Path::new("agent.toml"))?;
let agent = agent_from_config(&config)?;

Re-exports§

pub use reference::parse_config_ref;
pub use reference::ConfigRef;

Modules§

reference
Generic ID reference protocol for config objects.

Structs§

AgentConfig
Top-level agent configuration. All sections are optional with defaults.
AgentInstanceSection
A named agent instance that can reference or override a profile.
AgentSection
Agent-level configuration. system_prompt here overrides the profile’s.
CacheSection
Cache configuration.
CallbacksSection
Callback references — Phase 2 WASM plugin loading. In Phase 1, these are stored as strings but not acted upon.
CompactionInstanceSection
A named compaction instance — a variation of the compaction defaults.
CompactionSection
Compaction configuration — unifies context management settings (G5).
CompatSection
OpenAI-compat quirk flags.
CostSection
Cost rates for token usage tracking.
ExecutionSection
Execution limits and related configuration.
HooksSection
Hook references — Phase 2 WASM plugin loading. In Phase 1, these are stored as strings but not acted upon.
ProfileInstanceSection
A named profile instance — a variation of the profile blueprint.
ProfileSection
Profile section — the reusable agent blueprint. Maps to AgentProfile in the builder. Multiple agent instances can share the same profile.
PromptInstanceSection
A system prompt instance — fills content into a strategy’s blocks.
ProviderInstance
A named provider instance with overrides.
ProviderSection
Provider configuration — model identity, API credentials, and protocol.
RetrySection
Retry configuration for transient provider errors.
SessionSection
Session-level configuration.
SkillsSection
Skills configuration.
StrategyBlockSection
A block definition within a strategy template.
StrategyInstanceSection
A system prompt strategy instance — defines block structure.
SubAgentsSection
Sub-agent configuration.
SystemPromptSection
System prompt instances configuration.
SystemPromptStrategySection
System prompt strategy configuration.
ToolInstance
A named tool instance with configuration overrides.
ToolsSection
Tool configuration.

Enums§

ConfigError
Errors from config parsing and agent construction.
ConfigFormat
Supported config file formats.

Functions§

agent_from_config
Construct an agent from a parsed config.
agent_from_config_with_registry
Construct an agent from config, resolving tool names via a ToolRegistry (G10).
agents_from_config
Construct multiple agents from a config with agent instances.
parse_config
Parse a config string in the specified format.
parse_config_auto
Parse a config string, auto-detecting the format.
parse_config_file
Parse a config file, detecting format from the file extension.