Expand description
The agentd settings document — one nested document (YAML or JSON;
several files merge in order) whose every path is also AGENTD_<PATH> /
AGENT_<PATH> / <PATH> and --<path>. This module holds the typed
Settings, its JSON Schema (schema::schema), the load pipeline
(files → env → flags → typed → validated), the flat alias table
(--instruction, --intelligence, --model, --mcp, …), the
agentd --instruction X sugar, schema detection, and the reload
partition (which paths only a restart can change).
Layering: built-in < files < env < flags. Files compose with
JSON-Merge-Patch semantics; env sets a path (lists and maps are replaced,
never merged); flags apply in argument order — a generic --<path> SETS,
while a named repeatable alias (--mcp, --a2a-peer) ADDS to its list.
Re-exports§
pub use crate::engine::model::is_long_lived_start;
Modules§
- schema
- The JSON Schema (Draft 2020-12) of the settings document — hand-written
(no
schemars, the moat) and held faithful tosuper::Settingsby the tests insuper::tests, which walk both shapes object by object. It is the single source for the path bindings (envAGENTD_<PATH>names,--<path>flags,--help), for--config-schema=2, and for agentctl’s admission validation, so a section added here reaches all of them at once.
Structs§
- A2a
- A2aPeer
- A2aPush
- Push notifications: a caller registers a webhook and agentd POSTs its task’s updates there instead of holding a stream open.
- A2aTls
- AAuth
- Agent
- Agent
Tools - Alias
- A named flag → document-path alias.
- Audit
- Auth
- A unified per-endpoint authentication provider. A flat,
kind-discriminated record: only the fields relevant to the chosenkindare set, and semantic validation is what enforces which of them are required — the type itself cannot, because every field is optional for some other kind. - Auto
Context - Budget
- Budget
Window - Cgroup
- Checkpoint
- Context
- Degrade
- Diagnostics
- Collected diagnostics:
errorsfail the load (exit 2);warningsare advisory (logged, printed by--validate-config). - Display
- The client-chrome layout: ordered item lists for the top (header) and
bottom (status bar) edges.
None⇒ the built-in default. Clients skip an item they do not recognise instead of erroring, so a newer daemon can name items an older client has never heard of. The vocabulary isDISPLAY_ITEMS. - Dur
- A duration deserialized from
"10m"/"500ms"/ bare seconds (string or integer). Displays in the same string form. - Durability
- Exec
- The local command-runner controls. agentd’s default posture is no local
execution, so this stays off unless an operator both builds with
--features execAND setsenabled: true— two independent switches, so neither a config mistake nor a stock binary can turn it on alone. Even then it runs only allow-listed commands, in a confined directory, with a minimal env. Without the local runner theexectool is mapping-only: it can be delegated off-box viatools.overrides. It carries thesensitive+egresstrifecta tags, so enabling it narrows what else the agent may compose with. - Found
Ref - One
{{…}}reference found byscan_references. - Goal
- The self-correcting goal watchdog. A supervisor-level periodic check of
whether the configured
statementis achieved (or the agent is stuck), with a configurable disposition. It runs beside the agent loop and never blocks it, so a slow judge cannot stall real work. - Goal
Check - Header
Match - Hmac
- HttpOp
- Identity
- Instance
Limits - Intelligence
- Interface
- The display-client interface: the opt-in surface a thin TUI/web-UI
client rides — the global
SubscribeToEventsfeed and theinterface.*/debug read ops, served on the existing A2A listener (no new socket). Default-OFF: withenabled: falsethose methods answer UNSUPPORTED_OPERATION and the core A2A surface is byte-identical.debugadditionally exposes internals (conversation transcripts, per-step run detail, the live log ring, audit records on the feed) — operator-grade information; leave it off in production unless you need it.originslets a hosted web UI (a non-loopback browser origin) through the DNS-rebind guard with CORS; loopback origins are always accepted. - Knowledge
- Lifecycle
- Limits
- Loaded
- The result of a v2 load: the typed settings plus the documents they came from (the merged FILE document is kept for secret-provenance validation and for the reload diff).
- Mcp
- McpOauth
- McpServer
- Memory
- Model
Tier - One named model tier.
- Observability
- Otel
- Pairing
- Pairing-code login. The code is a 6-digit value derived
from a per-process random seed and the current 60-second window — shown
only to operators (
pairing.code), verified with the previous window’s grace, rate-limited, and exchanged (Pair) for a high-entropy session token that lives in memory untilttl(or restart). - Param
Spec - One declared template parameter — the only hole a spawn may fill.
- Plan
- Policy
- One rule: what it matches, and what happens.
- Policy
Match - Pricing
- Principal
- Principal
Match - Quotas
- Reserve
- Retention
- What to keep once a run is over.
- RunLimits
- RunRetention
- Runtime
Events - Which of the daemon’s own events reach a stream, and at what rate.
- Search
- Secret
- A credential-bearing string. From a FILE it must be a
{{secret:…}}/{{secret-file:…}}reference — validation over the file document enforces that, so a config document never carries a live credential — while an env/flag value may be inline.Debugnever shows the contents. - Security
- Service
- A service catalog entry: a named external service this deployment may
use — connection settings, one shared credential, authoritative trifecta
tags (a floor for any matching endpoint, not just referencing ones), and a
tool-surface ceiling consumers can only narrow. The catalog itself dials
nothing;
mcp.serversentries reference it. - Settings
- The typed v2 settings document. Every object is
deny_unknown_fields; every section defaults so a minimal document (agent.instructionalone) is complete. - Skill
Source - Skills
- Slow
- Store
- Store
File store.file. The only setting is where the state lives; the adapter needs nothing else, so the block itself is optional —kind: filewith no block resolves the root from the environment (file_store_root).- Store
Http - Store
Mcp - StoreOp
- Stream
Cfg - One declared event stream.
- Stream
Retention - Retention: whichever bound trims first. Neither set = the 10k default — an unbounded stream on a disk the pressure system guards would be a self-inflicted shed.
- Subagent
Defaults - Subagent
Limits - Subagent
Template - Subagents
- The
subagents:section: what the model may spawn, and how. - Summarize
- Tool
Override - Tools
- Webhook
Auth - A webhook’s inbound authentication. Best practice (and the default guidance)
is HMAC over the raw body; a required-header or bearer match are alternatives;
none: trueis an explicit loopback-only dev opt-out. - Webhooks
- The webhook inbound HTTP surface: a dedicated listener serving the
webhookstart nodes andwait: {on: webhook}callbacks. Auth is per node — eachwebhookdeclares its own verification — so one permissive route cannot weaken the others; the listener-wide default set here applies only to nodes that declare noauthof their own. - Workflow
Limits - Ceilings a workflow definition is checked against at load time.
- Workflow
Security - Whether the agent may rewrite its own workflows.
Enums§
- Alias
Kind - How a named flag maps onto the document.
- Approval
- How much a person wants to be asked.
- Ask
- What the loader was asked to do besides loading (short-circuits the CLI handles).
- AskHuman
Fallback - The
ask_humanfallback disposition. - Audit
Sink - Auth
Kind - The authentication provider family.
- Auto
Context On - Budget
Scope - Budget
Tactic - Detected
- Discover
- Durability
Level - Egress
- Whether outbound dials are confined to the service catalog.
- Goal
Action - A goal disposition. Deserialized from a bare string
(
finish/idle/replan/escalate) or{ workflow: <name> }. - OAuth
Grant - The OAuth 2.1 grant type.
- OnWorkflow
Finished - Policy
Action - Policy
Caller - Preflight
- Reserve
Estimate - Role
- RunUntil
- Select
Keyword - Service
Kind - Which outbound surface a catalog entry describes. Matching is
KIND-FILTERED: an MCP dial only matches
mcpentries, anhttpstep onlyhttpentries, and so on, because one host may legitimately serve several kinds under different trust budgets. - Store
Kind - Store
OnError - Structured
Output - Tool
Select all|none| an explicit list.- Wake
Event - Window
Unit - Work
Durability
Constants§
- ALIASES
- The alias table. The order of entries is irrelevant — flags take effect in the order they appear on the command line, not the order they are listed here.
- DEFAULT_
MESSAGE_ DEPTH - The default ceiling on chained
messagedeliveries. Deep enough for real delegation — a schedule waking the agent, which runs a workflow, which asks a question back — and shallow enough that a runaway is caught in seconds. - DEFAULT_
TAP_ QUEUE - The default bound on the runtime-event queue.
- DISPLAY_
ITEMS - The display items a client knows how to render.
- ENV_
ALIASES - Short env names → document paths. The derived
AGENTD_<PATH>names are the primary surface; these are the shorter spellings a quickstart or a k8s manifest can use instead. Branded (AGENTD_) and neutral (AGENT_) prefixes both apply, as does the bare name. - REMOVED_
FLAGS - Flags agentd does not accept, each paired with the hint that replaces it. Naming one fails the load with its hint, so a stale command line is a loud error rather than a flag that is silently ignored.
- RESTART_
ONLY_ PATHS - Restart-only path prefixes: a live reload whose effective document differs
under any of these is refused (
restart_required). - V1_KEYS
- v1 (flat) top-level keys.
- V2_KEYS
- Top-level keys only the settings document has.
limitsis deliberately absent: it exists in both schemas, so it decides nothing.intelligenceis absent for a different reason — it is a STRING (the endpoint list) in the flat schema but an OBJECT here, sodetectjudges it by shape.
Functions§
- detect
- Decide which schema a merged document speaks.
- egress_
allows - The dial-time egress check.
Openalways passes;Closedrequires the URL to match a catalog entry of the surface’s kind, so an uncatalogued host cannot be reached even if some other config path names it. - file_
store_ root - The
filestore’s root directory, first that applies:store.file.path,$AGENTD_STATE_DIR,$XDG_STATE_HOME/agentd/state,$HOME/.local/state/agentd/state, else the OS temp dir. - help_
section - The
--helpsection for the v2 paths. - help_
text - The v2
--helptext: usage, the alias flags, the removed flags, and every config path (flag · env). - hmac_
algos - Every
hmac.algoin a document, with where it sits. - load
- Load, layer and validate a v2 document from
args(excluding the program name) andenv. Returns(Loaded, Ask);Asktells the caller what the invocation wants (--help,--config-schema,--validate-config, …). Errors areConfigError::Usage(exit 2), before any side effect. - looks_
like_ resource_ uri scheme://…with no whitespace, and a scheme that is not a barehttp(s)URL to a web page… — any<alpha><alnum+.->://single token counts; the registry decides which server serves it.- missing_
references - The references in
valuethat would NOT resolve right now — secrets against the environment (and any interactively-entered values), secret-files against the filesystem,config.*againstvars. One message per missing reference, deduplicated, every location listed. - probe
- Probe the invocation without side effects: which schema the config files
speak (
Detected), somaincan route to the v2 runtime. - resolve_
services - Resolve
service:references against the catalog and apply the unconditional tag floor. Mutatesmcp.serversin place — after this, every server carries its effective endpoint, auth, headers, admission lists and tag set, so validation, the trifecta gate and the runtime all judge the outcome rather than each re-deriving it. Must therefore run BEFORE validation. Returns the resolution errors, for aggregation with validation’s. - restart_
only_ diff - The restart-only paths whose values differ between two effective documents.
- scan_
references - Collect every
{{secret:…}},{{secret-file:…}}and{{config.…}}reference invalue, with where each sits. - service_
match - Match a URL against the catalog’s entries OF ONE KIND: scheme and authority
must be equal (host case-insensitively), and the URL’s path must extend the
entry’s path on a segment boundary — so
/v1never matches/v1betaX. Returns the matching entry and refuses nothing; the caller decides what a non-match means (Egress::Closedrefuses it). - substitute_
config_ vars - Substitute
{{config.NAME}}tokens invaluefromvars, appending every unresolved reference toerrs(withatnaming where it sat). - validate
- workflow_
is_ long_ lived - Whether a raw workflow document has a long-lived start node.
- workflow_
uses_ webhook - Whether a raw workflow document uses the inbound webhook surface — a
webhookstart node, or await: {on: webhook}callback (either needswebhooks.listen).