Skip to main content

Module config

Module config 

Source
Expand description

Configuration: precedence + validate-at-startup. RFC 0011 §2-§3.

Precedence, top wins: built-in default < config FILE < env var < CLI flag (RFC 0017 §3.2). Everything is env-settable (12-factor). The optional declarative file ([file] — YAML or JSON, --config/AGENTD_CONFIG) carries only verbose structural config (MCP-server inventory, declared subscriptions, A2A peers, limits, model/log knobs) and never secrets — those stay env/flag only. The whole config is validated before any side effect — a bad config exits 2 in milliseconds, not after an LLM round-trip.

Module layout: [file] (the config document: format detection, the typed ConfigFile shape, the JSON Schema), yaml (the hand-rolled YAML-subset reader), paths (schema-derived path bindings: AGENTD_<PATH> env names and --<path> flags for every config-file path), [watch] (the inotify reload trigger).

Modules§

file
The declarative config file (RFC 0017 §3) + its JSON Schema (§4.2).
paths
Schema-derived path bindings: every path in the config-file schema is also settable as an env var and as a generic --<path> flag, with names derived mechanically from the path — so a re-defined parameter set needs no per-field plumbing here.
v2
Configuration schema v2 (RFC 0030) — the agentd 2.0 settings document.
yaml
A hand-rolled YAML subset reader for config files → serde_json::Value.

Structs§

A2aPeerSpec
A declared A2A peer: a name and a client transport endpoint to reach a remote A2A agent (or the on-node gateway that forwards into the mesh). This is the delegation-backend axis of RFC 0020 §3 — a2a.delegate looks a peer up here and runs the A2A client against endpoint. The endpoint is an A2A client transport: https://host[:port] (the target-vision transport; loopback http:// for dev) or the legacy unix:/path / vsock:CID:PORT. No secrets live here. Serializable so it travels in the spawn payload to subagents, exactly like mcp_servers (RFC 0009 §spawn-payload).
AAuthSettings
AAuth [DRAFT] agent-identity settings (RFC 0023). Serde-serializable so it rides the spawn payload verbatim (one identity per process tree). Always defined (not feature-gated) so payload plumbing is feature-clean; the CLI flags that populate it require --features aauth at validation.
AuthSpec
The runtime shape of a unified auth: credential provider (RFC 0031 §5). Secret-free (every credential input is a {{secret:…}} template), so it rides the spawn payload and logs safely. kind is static/oauth2.
Config
The fully-resolved, validated configuration.
Diag
A reload diagnostic (RFC 0017 §5.4). Warn is advisory (a restart-only field merely present in the file — it works, it just pins you to restart-to-change); Error is fatal to the reload (it differs on a live reload, or the reloadable subset is internally inconsistent). --validate-config reports both; the reload path aborts on any Error.
McpOauthSpec
The runtime shape of an MCP server’s OAuth 2.1 client-credentials config (RFC 0031 §7 — the client-credentials grant). Serializable so it rides the spawn payload verbatim; client_secret is a secret-free {{secret:…}} template resolved only at token-fetch time.
McpServerSpec
A declared MCP server. Serializable because it travels in the subagent spawn payload as the child’s scoped server subset (RFC 0005, RFC 0009).

Enums§

A2aEndpoint
The client transport an A2aPeerSpec endpoint resolves to. Parsed once (scheme-validated at startup), then the A2A client dials it. vsock:CID:PORT requires both forms of a cid+port (no wildcard — a client dials a concrete peer, unlike the --serve-mcp listen form which may wildcard).
ConfigError
What load() can short-circuit with. Help/Version/Capabilities are not errors (exit 0); Usage is a validation/parse failure (exit 2, RFC 0011 §5). Capabilities carries the pretty-printed manifest JSON — the side-effect-free admission probe (agentd --capabilities, RFC 0015 §5.2), short-circuited before run-required validation so it succeeds even with no instruction (agentctl probes an image without a full run config).
DiagLevel
Mode
Execution mode — one supervisor loop, four exit predicates (RFC 0008).
ServeTarget
Where --serve-mcp binds the served self-MCP (RFC 0015 §3.1). Stdio is the implicit default (no --serve-mcp). The sole transport is Httphttps://HOST:PORT (TLS, the control plane) or http://LOOPBACK:PORT (plaintext, loopback-only dev/tests).
SwapPolicy
Model hot-swap policy (RFC 0018 §5.3, --model-swap / AGENTD_MODEL_SWAP): what an in-flight run does when a reload changes the model under it. An endpoint repoint (model unchanged) is ALWAYS finish-on-old / invisible (§5.1), regardless of this policy. Default FinishOnOld. Serialized into the ControlMsg::SwapIntel frame so the child applies the same policy the supervisor was configured with.

Constants§

DISCOVERED_CONFIG_NAMES
The file names agentd looks for when an invocation names no config.
RESTART_ONLY_FIELDS
The names of the restart-only fields (RFC 0017 §5.1, BINDING). A live reload whose new-vs-running diff touches ANY of these is rejected with reason="restart_required" (agentctl rolls a pod restart — its policy). They also drive the “restart-only field set in the file” warning (§5.4 check 1). Sharding (--shard) and claim routes are restart-only (RFC 0019 §4.3 — shard identity is immutable).

Functions§

discovered_config_in
Which of DISCOVERED_CONFIG_NAMES exist in dir, in order.
is_mcp_endpoint
Does s name a remote MCP endpoint? The four Streamable-HTTP transport schemes agentd dials (RFC 0004 / RFC 0006).
mcp_endpoint_scheme_ok
Whether an MCP-server endpoint scheme is admissible: https://, or a loopback http:// (dev). The retired unix:/vsock: schemes and non-loopback plaintext are rejected. This is the agentd-side gate applied BEFORE the reusable crate’s McpEndpoint::parse (which still accepts the sockets) so a config-file server — which bypasses is_mcp_endpoint / CLI parsing — is held to the same HTTPS-only rule.
parse_duration
Parse 600s, 5m, 2h, 500ms, or a bare integer (seconds).