config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config loads the Agent Runtime configuration from a YAML file (server / db / memory sections) with environment-variable overrides. The YAML layout mirrors the XiaoQinglong agent-frame config so operators can reuse familiar conventions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolvePath

func ResolvePath(path string) string

ResolvePath returns the exact configuration path used by Load.

Types

type Config

type Config struct {
	Server     ServerConfig     `yaml:"server"`
	DB         DBConfig         `yaml:"db"`
	Memory     MemoryConfig     `yaml:"memory"`
	Intent     IntentConfig     `yaml:"intent"`
	Research   ResearchConfig   `yaml:"research"`
	Sandbox    SandboxConfig    `yaml:"sandbox"`
	Skills     SkillsConfig     `yaml:"skills"`
	Plugins    PluginsConfig    `yaml:"plugins"`
	Operations OperationsConfig `yaml:"operations"`
}

Config is the root configuration.

func Default

func Default() Config

Default returns a Config populated with sane defaults.

func Load

func Load(path string) (Config, error)

Load reads configuration from path (if it exists), then applies environment overrides. A missing file is not an error: defaults + env are used instead.

type DBConfig

type DBConfig struct {
	Enabled         bool   `yaml:"enabled"`
	DBType          string `yaml:"db_type"`
	Username        string `yaml:"username"`
	Password        string `yaml:"password"`
	DBHost          string `yaml:"db_host"`
	DBPort          int    `yaml:"db_port"`
	DBName          string `yaml:"db_name"`
	SSLMode         string `yaml:"ssl_mode"`
	MaxOpenConn     int    `yaml:"max_open_conn"`
	MaxIdleConn     int    `yaml:"max_idle_conn"`
	ConnMaxLifetime int    `yaml:"conn_max_lifetime"` // seconds
	LogMode         int    `yaml:"log_mode"`
}

DBConfig configures the PostgreSQL connection (gorm).

func (DBConfig) DSN

func (d DBConfig) DSN() string

DSN builds a PostgreSQL DSN from the DB config.

type IntentConfig added in v1.0.0

type IntentConfig struct {
	Mode             string  `yaml:"mode"`
	TimeoutMS        int     `yaml:"timeout_ms"`
	MinConfidence    float64 `yaml:"min_confidence"`
	MaxHistory       int     `yaml:"max_history"`
	LanguagePacksDir string  `yaml:"language_packs_dir"`
}

IntentConfig controls deterministic language packs and the optional model-assisted intent classifier.

type MemoryConfig

type MemoryConfig struct {
	Enabled          bool `yaml:"enabled"`
	AutoMigrate      bool `yaml:"auto_migrate"`
	BackgroundReview bool `yaml:"background_review"`
	MaxReviewMemory  int  `yaml:"max_review_memory"`
	InjectIntoPrompt bool `yaml:"inject_into_prompt"`
}

MemoryConfig configures the memory module behaviour.

type ModelConfig

type ModelConfig struct {
	Provider string `yaml:"provider"`
	Name     string `yaml:"name"`
	APIKey   string `yaml:"api_key"`
	APIBase  string `yaml:"api_base"`
}

ModelConfig is the default model used when a request omits models.

type OperationsConfig added in v1.0.0

type OperationsConfig struct {
	MaxInflight       int `yaml:"max_inflight"`
	MaxQueue          int `yaml:"max_queue"`
	AdmissionWaitMS   int `yaml:"admission_wait_ms"`
	RequestTimeoutSec int `yaml:"request_timeout_sec"`
}

OperationsConfig bounds concurrent work and request lifetime.

type PluginsConfig added in v1.0.0

type PluginsConfig struct {
	Enabled          bool   `yaml:"enabled"`
	Dir              string `yaml:"dir"`
	RegistryPath     string `yaml:"registry_path"`
	TrustStorePath   string `yaml:"trust_store_path"`
	AuditPath        string `yaml:"audit_path"`
	RequireSignature bool   `yaml:"require_signature"`
}

PluginsConfig controls the fail-closed signed Capability Provider loader.

type ResearchConfig added in v0.1.4

type ResearchConfig struct {
	Enabled                  bool     `yaml:"enabled"`
	Providers                []string `yaml:"providers"`
	MaxQueries               int      `yaml:"max_queries"`
	MaxPages                 int      `yaml:"max_pages"`
	MaxRounds                int      `yaml:"max_rounds"`
	ResultsPerQuery          int      `yaml:"results_per_query"`
	TimeoutSec               int      `yaml:"timeout_sec"`
	CacheDir                 string   `yaml:"cache_dir"`
	CacheTTLMin              int      `yaml:"cache_ttl_min"`
	NewsCacheTTLMin          int      `yaml:"news_cache_ttl_min"`
	ProviderTimeoutSec       int      `yaml:"provider_timeout_sec"`
	ProviderFailureThreshold int      `yaml:"provider_failure_threshold"`
	CircuitOpenSec           int      `yaml:"circuit_open_sec"`
	ModelPlanning            bool     `yaml:"model_planning"`
	SemanticVerification     bool     `yaml:"semantic_verification"`
	AdvisorTimeoutSec        int      `yaml:"advisor_timeout_sec"`
	MaxAdvisorClaims         int      `yaml:"max_advisor_claims"`
}

ResearchConfig controls the code-owned multi-source research loop.

type SandboxConfig

type SandboxConfig struct {
	DefaultImage string `yaml:"default_image"`
	PptxImage    string `yaml:"pptx_image"`
	Workdir      string `yaml:"workdir"`
	TimeoutMs    int    `yaml:"timeout_ms"`
}

SandboxConfig holds operator-tunable defaults for skill sandbox execution. Per-request Sandbox settings still take precedence when provided.

type ServerConfig

type ServerConfig struct {
	GRPCAddr string      `yaml:"grpc_addr"`
	HTTPAddr string      `yaml:"http_addr"`
	Model    ModelConfig `yaml:"default_model"`
}

ServerConfig holds listen addresses and default model settings.

type SkillsConfig

type SkillsConfig struct {
	Dir        string `yaml:"dir"`         // overrides skill discovery directory
	ConfigPath string `yaml:"config_path"` // skills-config.yaml path
	GlobalDir  string `yaml:"global_dir"`  // additional skills directory to scan
}

SkillsConfig configures where skills and skill config are located.

Jump to

Keyboard shortcuts

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