Expand description
Configuration types for the Agent system
This module defines configuration structures that control agent behavior. All configs have sensible defaults and can be loaded from files or environment.
§Design Principles
- Sensible Defaults - Should work out of the box
- Optional Fields - Only require what’s essential
- Serializable - Can be loaded from TOML/JSON/YAML
- Type Safe - Invalid configs won’t compile
§Loading Configuration
Configuration is loaded from multiple sources with the following priority:
- Environment variables (highest priority)
- Config file (if specified or found)
- Default values (lowest priority)
§Config File Discovery
If no config file is specified, the following locations are searched:
./agent.toml(current directory)~/.config/agent/config.toml(user config directory)
§Environment Variables
The following environment variables are supported:
ANTHROPIC_API_KEY- API key for AnthropicOPENAI_API_KEY- API key for OpenAIAGENT_MODEL- Override the default modelAGENT_PROVIDER- Override the default provider
§Example
ⓘ
use codive_core::config::AppConfig;
// Load from default locations with env var overrides
let config = AppConfig::load(None)?;
// Load from specific file
let config = AppConfig::load(Some("./my-config.toml"))?;Structs§
- Agent
Config - Configuration for an agent instance
- AppConfig
- Top-level application configuration
- McpConfig
- Configuration for MCP (Model Context Protocol) servers
- McpServer
Config - Configuration for a single MCP server
- Model
Config - Configuration for the LLM model
- Prompt
Config - Configuration for prompt management
- Provider
Info - Information about a supported LLM provider
- Server
Config - Configuration for the server component
- TuiConfig
- Configuration for the TUI (Terminal User Interface)
- Verification
Config - Configuration for AI-driven code verification
Enums§
- Config
Error - Errors that can occur when loading configuration
- McpTransport
- Transport type for MCP communication
Constants§
- PROVIDERS
- Registry of supported providers in priority order. When auto-detecting, the first provider with an available API key is used. Models are selected for best coding performance (as of Jan 2026).
Functions§
- detect_
provider - Detect the best available provider based on API keys. Returns the first provider that has an API key set in the environment.
- get_
provider - Get provider info by name