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§
- A2aPeer
Spec - 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.delegatelooks a peer up here and runs the A2A client againstendpoint. The endpoint is an A2A client transport:https://host[:port](the target-vision transport; loopbackhttp://for dev) or the legacyunix:/path/vsock:CID:PORT. No secrets live here. Serializable so it travels in the spawn payload to subagents, exactly likemcp_servers(RFC 0009 §spawn-payload). - AAuth
Settings - 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 aauthat validation. - Auth
Spec - 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.kindisstatic/oauth2. - Config
- The fully-resolved, validated configuration.
- Diag
- A reload diagnostic (RFC 0017 §5.4).
Warnis advisory (a restart-only field merely present in the file — it works, it just pins you to restart-to-change);Erroris fatal to the reload (it differs on a live reload, or the reloadable subset is internally inconsistent).--validate-configreports both; the reload path aborts on anyError. - McpOauth
Spec - 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_secretis a secret-free{{secret:…}}template resolved only at token-fetch time. - McpServer
Spec - 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
A2aPeerSpecendpoint resolves to. Parsed once (scheme-validated at startup), then the A2A client dials it.vsock:CID:PORTrequires both forms of a cid+port (no wildcard — a client dials a concrete peer, unlike the--serve-mcplisten form which may wildcard). - Config
Error - What
load()can short-circuit with.Help/Version/Capabilitiesare not errors (exit 0);Usageis a validation/parse failure (exit 2, RFC 0011 §5).Capabilitiescarries 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). - Diag
Level - Mode
- Execution mode — one supervisor loop, four exit predicates (RFC 0008).
- Serve
Target - Where
--serve-mcpbinds the served self-MCP (RFC 0015 §3.1).Stdiois the implicit default (no--serve-mcp). The sole transport isHttp—https://HOST:PORT(TLS, the control plane) orhttp://LOOPBACK:PORT(plaintext, loopback-only dev/tests). - Swap
Policy - Model hot-swap policy (RFC 0018 §5.3,
--model-swap/AGENTD_MODEL_SWAP): what an in-flight run does when a reload changes themodelunder it. An endpoint repoint (model unchanged) is ALWAYS finish-on-old / invisible (§5.1), regardless of this policy. DefaultFinishOnOld. Serialized into theControlMsg::SwapIntelframe 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_NAMESexist indir, in order. - is_
mcp_ endpoint - Does
sname 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 loopbackhttp://(dev). The retiredunix:/vsock:schemes and non-loopback plaintext are rejected. This is the agentd-side gate applied BEFORE the reusable crate’sMcpEndpoint::parse(which still accepts the sockets) so a config-file server — which bypassesis_mcp_endpoint/ CLI parsing — is held to the same HTTPS-only rule. - parse_
duration - Parse
600s,5m,2h,500ms, or a bare integer (seconds).