Documentation
¶
Overview ¶
Package config loads agent.toml into a typed Config.
The package follows the same composable-primitives pattern as agentkit/credentials and agentkit/policy: individual sources are constructed explicitly, and the caller assembles layers when needed. No discovery logic lives here — that belongs in the consuming application.
Core API:
cfg, err := config.FromFile("agent.toml").Get()
cfg, err := config.NewUnion(
config.FromFile("~/.agent/agent.toml"),
config.FromFile("./agent.toml"),
).Get()
Credentials are not in agent.toml. Inject APIKey from your credential store into each llm.Config before calling llm.New:
cred, _ := credStore.Get(cfg.Models.Default.Service) cfg.Models.Default.APIKey = cred.APIKey model, err := llm.New(cfg.Models.Default)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("config: not found")
ErrNotFound is returned by a Source when the underlying config file does not exist. NewUnion silently skips sources that return this error.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Models holds all LLM configurations: the default, supervisor, and
// named profiles. Inject APIKey from credentials before calling llm.New.
Models Models
// MCP holds configured MCP servers grouped by transport type.
MCP MCPServers
// Skills are directories searched for skill bundles. The caller opens
// each path as an *os.Root before passing them to agentfile.Config.Skills.
Skills []string
// Security is the fallback content-guard configuration used when the
// Agentfile has no SECURITY directive.
Security Security
}
Config holds the parsed contents of agent.toml as ready-to-wire agentkit types. Fields with empty/zero values were absent from the source file(s).
agent.toml is runtime configuration (models, MCP, security, skills). Workflow identity — name, inputs, goals — belongs in the Agentfile.
func Merge ¶
Merge returns base with override applied. Fields in override take precedence when non-zero; zero values leave the base field unchanged.
Models.Profiles and MCP maps are unioned: override entries win on name collision. Skills are concatenated with override paths first so higher-priority skills shadow lower-priority ones on bare-name lookup.
The supervisor default (Models.Supervisor → Models.Default when unset) is applied after merging so it reflects the merged Default, not either layer's individual Default.
type MCPServers ¶
type MCPServers struct {
Stdio map[string]mcp.ServerConfig
HTTP map[string]mcp.HTTPConfig
}
MCPServers groups MCP server configs by transport. The MCP spec treats stdio and HTTP as distinct transports with separate configuration shapes.
type Models ¶
type Models struct {
// Default is the primary model for the workflow.
Default llm.Config
// Supervisor is the model for the supervision layer. Defaults to Default
// when no [supervisor] section is present in agent.toml.
Supervisor llm.Config
// Profiles maps REQUIRES profile names to their LLM configurations.
Profiles map[string]llm.Config
}
Models holds all LLM model configurations for a workflow.
type Security ¶
type Security struct {
// Level is the inspection regime: "default" (cheap heuristics on triggers),
// "paranoid" (full inspection on every tool call), or "research" (full
// inspection + permitted scope). Empty means use the Agentfile's own
// SECURITY directive, or "default" if the Agentfile has none.
Level string
// Scope describes permitted operations for the "research" level.
// Must be non-empty when Level is "research".
Scope string
}
Security describes the content-guard posture for the workflow. Level selects the inspection regime; Scope is required only for the research level and declares the boundary within which security-sensitive operations are permitted.