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, RFC 0017 §6.1). The token is read+trimmed from this file at load (and re-readable for rotation); the resolved value lands in intelligence_token, never in a log. The --intelligence-token flag/env stays as the inline source.

§model: Option<String>§model_swap: SwapPolicy

Model hot-swap policy (RFC 0018 §5.3, --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 (model unchanged) is always finish-on-old regardless (§5.1). 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). The delegation-backend axis of RFC 0020 §3: a2a.delegate dials these. Only honoured in --features a2a builds (validated at startup).

§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 (RFC 0008 §spawn-vs-continue). 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; RFC 0025). 0 = unbounded (today’s behaviour). 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 (pivot Phase 2). Required when serving TLS; the file contents (a private key) are read at bind time and never logged (RFC 0012 §3.7).

§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 (the PRIMARY way the Management trust domain is minted — RFC 0015 §3.4, pivot decision).

§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 [DRAFT] agent-identity config (RFC 0023): 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 (else a trace is minted from the run id). RFC 0010 §context-propagation.

§log_content: bool

Opt-in content capture (RFC 0010 §2.9). Off by default: telemetry logs hashes/lengths only; --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. RFC 0010.

§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. RFC 0010, assessment §2.3. 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 (RFC 0012 §3.2). Process-global operator override — deliberately NOT carried in the spawn payload.

§cron: Option<String>

Optional 5-field UTC cron schedule for --mode schedule (RFC 0008). 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, RFC 0016 §6.3). Atomic write (temp + rename). Off for a bare CLI run; inert for --mode reactive (warned at startup — a reactive daemon has no single terminal outcome, §6.4).

§budget_exit_code: Option<i32>

Operator remap for the two policy budget exit codes (--budget-exit-code N, RFC 0011 §5.2 / ACC exit-codes.table.json x-budget-exit-code-remap). 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, RFC 0016 §7.2/§11): 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 (RFC 0006 §3, settable only via the config file’s intelligence_headers, RFC 0017 §3.3). Values are templates that may carry {{secret:NAME}} / {{secret-file:PATH}} refs (§6) — the NAMES/refs are structural; the resolved secret is never stored here or logged. An inline secret-shaped value is rejected at validation (§3.1). A BTreeMap so the order is deterministic.

§watch_config: bool

Watch the config file for changes and reload (--watch-config / AGENTD_WATCH_CONFIG, RFC 0017 §5.2). When set, the reactive supervisor arms a raw inotify watch on the config file’s PARENT DIRECTORY (so a Kubernetes ConfigMap volume swap — an atomic directory-symlink rename — is seen) and, on a change to the watched file, sets the SAME RELOAD latch SIGHUP does (RFC 0017 §5.2 “both triggers funnel into the identical reload routine”). Always-compiled (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, RFC 0011 §2.1 / RFC 0017 §3.2) and validating.

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 (RFC 0012 §3.1). An untagged MCP server contributes untrusted_input (the conservative default). Because scope narrows monotonically (RFC 0009), enforcing on this root union bounds the whole subagent tree.

Source

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

Reject inconsistent config before any side effect (RFC 0011 §2).

Source§

impl Config

Source

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

Re-resolve config for a hot reload (RFC 0017 §5.3 step 1): 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 (RFC 0017 §5.4), 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 (→ §5.3 step-2 ABORT, restart req’d).
  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 (RFC 0017 §4.2). Carries ONLY the reloadable structural fields — NO token, NO URL, NO secret, NO {{secret:…}} values (header NAMES only). Management-readable. Mirrors the manifest’s no-secret discipline (RFC 0012 §3.7): 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 = Infallible

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