Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package config loads agent settings from an optional YAML file layered over defaults.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the per-user config file, tinyagent/config.yaml under os.UserConfigDir, whether or not it exists.

func Find

func Find(explicit string) string

Find returns the config file to Load: explicit if set, else the per-user config if it exists, else "" for the defaults. A user config that exists but can't be read is still returned, so Load reports it by name.

Types

type AgentConfig

type AgentConfig struct {
	ReadOnly bool `yaml:"read_only"`
	// Model is the provider/model used when neither -m nor $AGENT_MODEL sets
	// one. "" falls back to the built-in default.
	Model string `yaml:"model"`

	SystemPrompt string  `yaml:"system_prompt"`
	StepLimit    int     `yaml:"step_limit"`
	CostLimit    float64 `yaml:"cost_limit"`
	WallTimeSec  int     `yaml:"wall_time_seconds"`

	BashTimeoutSec int `yaml:"bash_timeout_seconds"`
	MaxOutputChars int `yaml:"max_output_chars"`
	// MaxBackgroundProcesses bounds how many start_process processes may run
	// at once.
	MaxBackgroundProcesses int `yaml:"max_background_processes"`

	// Optional price override in USD per million tokens, for models
	// missing from the built-in price table.
	InputPricePerMTok  float64 `yaml:"input_price_per_mtok"`
	OutputPricePerMTok float64 `yaml:"output_price_per_mtok"`

	// ContextWindow, in tokens, overrides the built-in context window table.
	// 0 uses the table.
	ContextWindow int `yaml:"context_window"`

	MCPServers []MCPServer `yaml:"mcp_servers,omitempty"`
}

func Default

func Default() AgentConfig

func Load

func Load(path string) (AgentConfig, error)

Load returns the defaults overlaid with the YAML file at path. An empty path returns the defaults. Unknown keys are an error, so a typo can't silently drop a setting.

type MCPServer added in v0.4.0

type MCPServer struct {
	Alias               string   `yaml:"alias"`
	Command             string   `yaml:"command"`
	Args                []string `yaml:"args,omitempty"`
	Tools               []string `yaml:"tools"`
	Env                 []string `yaml:"env,omitempty"`
	DiscoveryTimeoutSec int      `yaml:"discovery_timeout_seconds"`
	CallTimeoutSec      int      `yaml:"call_timeout_seconds"`
}

MCPServer grants access to selected tools from one local stdio server.

Jump to

Keyboard shortcuts

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