config

package
v0.4.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config provides configuration management for AgentPipe. It defines the structure for YAML configuration files and handles loading, validation, and default value application.

Package config provides configuration management for AgentPipe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeConfig added in v0.3.0

type BridgeConfig struct {
	// Enabled determines if streaming bridge is active (disabled by default)
	Enabled bool `yaml:"enabled"`
	// URL is the base URL of the AgentPipe Web app (e.g., https://agentpipe.ai)
	URL string `yaml:"url"`
	// APIKey is the authentication key for the streaming API
	APIKey string `yaml:"api_key"`
	// TimeoutMs is the HTTP request timeout in milliseconds (default: 10000)
	TimeoutMs int `yaml:"timeout_ms"`
	// RetryAttempts is the number of retry attempts for failed requests (default: 3)
	RetryAttempts int `yaml:"retry_attempts"`
	// LogLevel is the logging level for bridge operations: "debug", "info", "warn", "error" (default: "info")
	LogLevel string `yaml:"log_level"`
}

BridgeConfig defines streaming bridge configuration for real-time conversation updates.

type Config

type Config struct {
	// Version is the configuration file format version
	Version string `yaml:"version"`
	// Agents is the list of agent configurations
	Agents []agent.AgentConfig `yaml:"agents"`
	// Orchestrator defines conversation orchestration settings
	Orchestrator OrchestratorConfig `yaml:"orchestrator"`
	// Logging defines logging behavior
	Logging LoggingConfig `yaml:"logging"`
	// Bridge defines streaming bridge settings
	Bridge BridgeConfig `yaml:"bridge"`
}

Config is the top-level configuration structure for AgentPipe. It defines agents, orchestration behavior, logging settings, and bridge streaming.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads and validates a configuration from a YAML file. It applies default values for any missing optional fields. Returns an error if the file cannot be read, parsed, or is invalid.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig creates a configuration with sensible defaults. The default log directory is ~/.agentpipe/chats.

func (*Config) SaveConfig

func (c *Config) SaveConfig(path string) error

SaveConfig writes the configuration to a YAML file. The file is created with 0600 permissions (read/write for owner only).

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for errors. It ensures at least one agent is configured, all required fields are present, agent IDs are unique, and the orchestration mode is valid.

type ConfigChangeCallback added in v0.0.16

type ConfigChangeCallback func(oldConfig, newConfig *Config)

ConfigChangeCallback is called when the configuration file changes. It receives the old and new configurations.

type ConfigWatcher added in v0.0.16

type ConfigWatcher struct {
	// contains filtered or unexported fields
}

ConfigWatcher watches a configuration file for changes and reloads it.

func NewConfigWatcher added in v0.0.16

func NewConfigWatcher(configPath string) (*ConfigWatcher, error)

NewConfigWatcher creates a new configuration watcher. It loads the initial configuration and sets up file watching.

func (*ConfigWatcher) GetConfig added in v0.0.16

func (cw *ConfigWatcher) GetConfig() *Config

GetConfig returns the current configuration (thread-safe).

func (*ConfigWatcher) OnConfigChange added in v0.0.16

func (cw *ConfigWatcher) OnConfigChange(callback ConfigChangeCallback)

OnConfigChange registers a callback to be invoked when the config changes. Callbacks are executed in the order they were registered.

func (*ConfigWatcher) StartWatching added in v0.0.16

func (cw *ConfigWatcher) StartWatching()

StartWatching begins monitoring the configuration file for changes. When a change is detected, the config is reloaded and callbacks are invoked. This method blocks, so it should typically be run in a goroutine.

func (*ConfigWatcher) StopWatching added in v0.0.16

func (cw *ConfigWatcher) StopWatching()

StopWatching stops monitoring the configuration file.

type LoggingConfig

type LoggingConfig struct {
	// Enabled determines if conversation logging is active
	Enabled bool `yaml:"enabled"`
	// ChatLogDir is the directory where chat logs are stored
	ChatLogDir string `yaml:"chat_log_dir"`
	// LogFormat is either "text" or "json"
	LogFormat string `yaml:"log_format"`
	// ShowMetrics determines if token/cost metrics are logged
	ShowMetrics bool `yaml:"show_metrics"`
}

LoggingConfig defines conversation logging behavior.

type OrchestratorConfig

type OrchestratorConfig struct {
	// Mode is the orchestration mode: "round-robin", "reactive", or "free-form"
	Mode string `yaml:"mode"`
	// MaxTurns is the maximum number of conversation turns (0 = unlimited)
	MaxTurns int `yaml:"max_turns"`
	// TurnTimeout is the maximum time an agent has to respond
	TurnTimeout time.Duration `yaml:"turn_timeout"`
	// ResponseDelay is the pause between agent responses
	ResponseDelay time.Duration `yaml:"response_delay"`
	// InitialPrompt is an optional starting prompt for the conversation
	InitialPrompt string `yaml:"initial_prompt"`
	// Summary defines conversation summary generation settings
	Summary SummaryConfig `yaml:"summary"`
}

OrchestratorConfig defines how the orchestrator manages conversations.

type SummaryConfig added in v0.4.1

type SummaryConfig struct {
	// Enabled determines if conversation summaries are generated (default: true)
	Enabled bool `yaml:"enabled"`
	// Agent is the agent type to use for summary generation (default: "gemini")
	Agent string `yaml:"agent"`
}

SummaryConfig defines conversation summary generation behavior.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL