Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 42 fields pub instruction: Option<String>, pub intelligence: Option<String>, pub intelligence_token: Option<String>, pub intelligence_token_file: Option<String>, pub model: Option<String>, pub model_swap: SwapPolicy, pub mcp_servers: Vec<McpServerSpec>, pub a2a_peers: Vec<A2aPeerSpec>, pub mode: Mode, pub subscribe: Vec<String>, pub continue_subscribe: Vec<String>, pub interval: Option<Duration>, pub max_steps: u32, pub max_tokens: u64, pub budget_tokens_lifetime: u64, pub deadline: Option<Duration>, pub max_depth: u32, pub run_id: String, pub log_level: Level, pub drain_timeout: Duration, pub serve_mcp: Option<String>, pub serve_cert: Option<String>, pub serve_key: Option<String>, pub serve_client_ca: Option<String>, pub serve_bearer: Option<String>, pub tls_ca: Option<String>, pub aauth: Option<AAuthSettings>, pub health_file: Option<String>, pub traceparent: Option<String>, pub log_content: bool, pub metrics_addr: Option<String>, pub cgroup: Option<String>, pub cgroup_memory_max: Option<String>, pub cgroup_pids_max: Option<String>, pub allow_trifecta: bool, pub cron: Option<String>, pub report_file: Option<String>, pub budget_exit_code: Option<i32>, pub events_ring: usize, pub intelligence_headers: BTreeMap<String, String>, pub watch_config: bool, pub config_files: Vec<String>,
}
Expand description

The fully-resolved, validated configuration.

Fields§

§instruction: Option<String>§intelligence: Option<String>§intelligence_token: Option<String>§intelligence_token_file: Option<String>

Path to a mounted file holding the intelligence credential (--intelligence-token-file / AGENTD_INTELLIGENCE_TOKEN_FILE). The token is read and trimmed from this file at load, and re-readable so a rotation is picked up; the resolved value lands in intelligence_token and never in a log. --intelligence-token is the inline alternative.

§model: Option<String>§model_swap: SwapPolicy

Model hot-swap policy (--model-swap / AGENTD_MODEL_SWAP): what an in-flight run does when a reload changes model under it. finish-on-old (default) | restart-turn. An endpoint repoint that leaves the model unchanged is always finish-on-old regardless. Reloadable: the reload fans the new policy down with the swap.

§mcp_servers: Vec<McpServerSpec>§a2a_peers: Vec<A2aPeerSpec>

Declared remote-A2A delegation peers (--a2a-peer name=endpoint) — what a2a.delegate dials. Only honoured in --features a2a builds, which startup validation enforces.

§mode: Mode§subscribe: Vec<String>§continue_subscribe: Vec<String>

Subscriptions routed to a warm continue-session rather than a fresh spawn per event: all events on the URI re-enter one live session, in order. Repeatable --continue <uri>.

§interval: Option<Duration>§max_steps: u32§max_tokens: u64§budget_tokens_lifetime: u64

Per-instance cumulative token budget across ALL runs/reactions (--budget-tokens-lifetime / AGENT_BUDGET_TOKENS). 0 = unbounded. Distinct from max_tokens, which boxes a single run: a bounded run folds min(max_tokens, lifetime) and trips EXIT_BUDGET(7); a reactive instance stops accepting new reactions and drains when the cumulative cap is reached.

§deadline: Option<Duration>§max_depth: u32§run_id: String§log_level: Level§drain_timeout: Duration§serve_mcp: Option<String>§serve_cert: Option<String>

TLS server cert / key PEM file paths for an https:// serve target. Required when serving TLS. Only the PATHS live here; the contents — one of them a private key — are read at bind time and never logged.

§serve_key: Option<String>§serve_client_ca: Option<String>

Client-CA PEM file path enabling mutual TLS on the serve target: peers must present a certificate chaining to it. This is the primary way the Management trust domain is minted.

§serve_bearer: Option<String>

Bearer-token secret for the serve target — the ALTERNATIVE auth to mTLS (Authorization: Bearer <token> mints Management). A sec::secret template ({{secret-file:PATH}} / {{secret:ENV}}) or a literal; resolved at bind time, never logged.

§tls_ca: Option<String>

Extra PEM CA file path trusted for OUTBOUND https:// dials (intelligence, MCP servers, A2A peers, OAuth), ADDED to the bundled webpki roots — the private/in-cluster PKI trust anchor (--tls-ca / AGENTD_TLS_CA). Public material (a CA certificate, never a key); installed process-wide at startup (crate::net::tls::install_extra_ca) and inherited by every subagent via the spawn payload. Set-once (restart-only): trust anchors must not move under a live run.

§aauth: Option<AAuthSettings>

AAuth agent-identity config: when the provider URL is set, agentd gets an Ed25519 identity + agent token and SIGNS every outbound MCP request. None = no AAuth (the default). Rides the spawn payload to subagents (one identity per process tree). Needs --features aauth.

§health_file: Option<String>§traceparent: Option<String>

Inbound W3C traceparent to continue; with none set, a trace is minted from the run id so a run always has one.

§log_content: bool

Opt-in content capture. Off by default: telemetry logs hashes and lengths only, so a trace backend never becomes an unreviewed copy of every tool argument. --log-content adds the actual tool args/results, truncated. Propagates to children via the telemetry block.

§metrics_addr: Option<String>

Opt-in HTTP probe/scrape surface (/metrics + /healthz + /readyz). Off unless set; only honoured in --features metrics builds.

§cgroup: Option<String>

Opt-in cgroup-v2 active enforcement: auto (derive <own-cgroup>/agentd) or an absolute path under /sys/fs/cgroup. Each run gets a child cgroup for atomic cgroup.kill teardown. Best-effort — disabled if not writable; agentd stays cgroup-aware, never cgroup-requiring. Note: if hard limits are requested and the path points at a shared/existing cgroup, delegating its controllers also enables them for its other children.

§cgroup_memory_max: Option<String>

Optional hard memory.max for each run’s cgroup (max or a size like 512M/2G/bytes). Needs --cgroup + a parent that can delegate the memory controller; otherwise it no-ops (teardown still works).

§cgroup_pids_max: Option<String>

Optional hard pids.max for each run’s cgroup (max or a count). Counts threads, not just processes, so set it generously (the root subagent is multi-threaded). Same delegation requirement as cgroup_memory_max.

§allow_trifecta: bool

Allow a lethal-trifecta grant (all three capability legs in one agent) instead of refusing at startup. A process-global operator override, deliberately NOT carried in the spawn payload — a child must be granted the exception on its own terms rather than inheriting it silently.

§cron: Option<String>

Optional 5-field UTC cron schedule for --mode schedule. Only honoured in --features cron builds; the production path is an external CronJob → --mode once.

§report_file: Option<String>

Where to write the run-outcome report at the terminal transition (--report-file PATH / AGENTD_REPORT_FILE). Written atomically via a temp file and rename, so a reader never sees a half-written report. Off for a bare CLI run, and inert for --mode reactive — a reactive daemon has no single terminal outcome, which startup warns about.

§budget_exit_code: Option<i32>

Operator remap for the two policy budget exit codes (--budget-exit-code N). None ⇒ no remap (the canonical table applies). When set, a final process exit of EXIT_PARTIAL (3) or EXIT_BUDGET (7) — and ONLY those two, the operator-tunable policy-intent codes — is returned to the OS as N instead, so a Job’s podFailurePolicy can treat a budget/partial outcome as success-or-fail per operator policy. Every other code (a deadline 124, a refusal 5, a clean 0) is NEVER remapped. The run report still records the canonical 3/7 projection + the precise status, so the durable record stays truthful (and schema-valid) regardless of the remap.

§events_ring: usize

Capacity of the bounded agentd://events ring (--events-ring N / AGENTD_EVENTS_RING): the last N emitted lines held in memory for the live-tail resource. Default 1024. Only consumed when the events surface is served (--serve-mcp + the events feature).

§intelligence_headers: BTreeMap<String, String>

Declared intelligence HTTP headers, settable only via the config file’s intelligence_headers. Values are templates that may carry {{secret:NAME}} / {{secret-file:PATH}} refs: the names and refs are structural, while the resolved secret is never stored here or logged. An inline secret-shaped value is rejected at validation. A BTreeMap, so header order is deterministic.

§watch_config: bool

Watch the config file for changes and reload (--watch-config / AGENTD_WATCH_CONFIG). When set, the reactive supervisor arms a raw inotify watch on the config file’s PARENT DIRECTORY — a Kubernetes ConfigMap volume swap is an atomic directory-symlink rename, which a watch on the file itself would miss — and, on a change to the watched file, sets the SAME RELOAD latch SIGHUP sets, so there is exactly one reload routine to reason about. Always compiled (a uniform Config); true needs the config-watch build feature (validated, exit 2) AND a config file to watch (--config/AGENTD_CONFIG, else exit 2 — watching nothing is a usage error). Off by default; SIGHUP is the portable, dependency-free default trigger.

§config_files: Vec<String>

The config files that were merged into the FILE layer, in order (AGENTD_CONFIG entries first, then each --config); empty when no file is in play. Informational — logged at startup, watched by --watch-config; never a reload diff (args/env are fixed for the process’s life).

Implementations§

Source§

impl Config

Source

pub fn load( args: &[String], env: &[(String, String)], ) -> Result<Config, ConfigError>

Resolve config from CLI args (excluding the leading program name) and the environment, applying precedence — built-in default < FILE < env < flag — and validating the result before any side effect.

Source

pub fn config_paths_from( args: &[String], env: &[(String, String)], ) -> Vec<String>

The config files in play for args/env, in merge order: the AGENTD_CONFIG / AGENT_CONFIG list (:-separated, PATH-style) first, then every --config <path> in argument order. Empty when none. Shared by load, the reload path, and the file watcher (which arms one watch per file). Pure.

Source

pub fn trifecta_grant_tags(&self) -> Vec<TrifectaTag>

The capability-tag union of the root agent’s grant, for the Rule-of-Two trifecta check. An untagged MCP server contributes untrusted_input, the conservative default. Because a subagent’s scope can only narrow, never widen, enforcing on this root union bounds the whole subagent tree.

Source

pub fn validate(&self) -> Result<(), ConfigError>

Reject inconsistent config before any side effect runs.

Source§

impl Config

Source

pub fn reload( args: &[String], env: &[(String, String)], ) -> Result<Config, ConfigError>

Re-resolve config for a hot reload: re-read ONLY the file and re-merge built-in<file<env<flag. args/env are the process’s original, fixed inputs — only the FILE can change between loads, so this keeps precedence correct (a flag still overrides the new file). Pure-CPU, no side effect. The returned Config is the fully-validated candidate; an invalid file/value is the same ConfigError::Usage startup would raise.

NB: --validate-config/--config-schema/--capabilities short-circuit inside load, but those flags never reach a running reactive daemon, so a reload’s args never carries them — this is the ordinary load path.

Source

pub fn reload_coherence_check( new: &Config, running: Option<&Config>, file_present: bool, ) -> Result<(), Vec<Diag>>

The reload-coherence check, run by BOTH --validate-config and the reload path. Pure-CPU, no side effect.

  1. (advisory) a restart-only field set in the FILE → Warn (file_present).
  2. (live reload only) any restart-only field that DIFFERS between new and runningError naming the field, which aborts the reload.
  3. the reloadable subset is internally consistent: every subscription/claim references a declared server where required, and server names are unique.

Ok(()) if no Error diagnostics (the Warns are still surfaced by the caller); Err(diags) carries every diagnostic when at least one is an error.

Source

pub fn effective_view(&self) -> Value

The reloadable, redacted view of the running config for agentd://config/effective. Carries ONLY the reloadable structural fields — no token, no URL, no secret, and header NAMES rather than values. Management-readable, and held to the same no-secret discipline as the manifest: nothing here can embed a credential.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Config) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more