pub struct HarnessConfig {Show 53 fields
pub config_version: u32,
pub listen: String,
pub upstream_url: String,
pub tool_upstream_url: Option<String>,
pub upstream_http2_prior_knowledge: bool,
pub upstream_read_timeout_s: Option<u64>,
pub upstream_chat_path: String,
pub upstream_api_key_env: Option<String>,
pub upstream_api_key_file: Option<String>,
pub upstream_auth_header: String,
pub upstream_auth_scheme: String,
pub upstream_authorization_passthrough: bool,
pub tool_upstream_bearer_env: Option<String>,
pub tool_upstream_bearer_file: Option<String>,
pub require_identity: bool,
pub audience: String,
pub identity_jwks_url: Option<String>,
pub identity_jwks_refresh_s: u64,
pub identity_allowed_issuers: Vec<String>,
pub identity_hmac_secret_file: Option<String>,
pub identity_hmac_kid: String,
pub enforce_identity_scopes: bool,
pub chat_scope: String,
pub session_close_scope: String,
pub session_promote_scope: String,
pub default_workflow: String,
pub consequential_tools: Vec<String>,
pub tool_schema_dir: Option<String>,
pub require_tool_schema: bool,
pub wasm_policy_paths: Vec<String>,
pub session_idle_close_s: u64,
pub atif_spool_dir: String,
pub bridge_data_dir: String,
pub bridge_backend: String,
pub bridge_manifest_path: String,
pub bridge_endpoint: Option<String>,
pub state_backend: String,
pub state_endpoint: Option<String>,
pub embedder_backend: String,
pub onnx_model_path: Option<String>,
pub onnx_tokenizer_path: Option<String>,
pub onnx_dimension: usize,
pub vector_backend: String,
pub qdrant_url: Option<String>,
pub qdrant_collection: String,
pub worker_channel_capacity: usize,
pub strict_stage_budget: bool,
pub breaker: BreakerConfig,
pub compression_enabled: bool,
pub budget: BudgetSpec,
pub reconcile_tick_s: u64,
pub max_request_bytes: usize,
pub dashboard_enabled: bool,
}Expand description
Top-level harness configuration.
Unknown keys are rejected (deny_unknown_fields) so a typo like
idel_timeout_s fails loudly at startup instead of being silently
ignored. Forward compatibility is handled by config_version gating,
not by tolerating unrecognized keys.
Fields§
§config_version: u32Config format version.
listen: StringListen address, e.g. 127.0.0.1:8484.
upstream_url: StringUpstream LLM provider base URL (OpenAI-compatible).
tool_upstream_url: Option<String>Optional downstream MCP/REST tool server URL. When absent, /v1/mcp
operates as a policy decision endpoint.
upstream_http2_prior_knowledge: boolUse cleartext HTTP/2 prior knowledge for trusted h2c upstreams.
upstream_read_timeout_s: Option<u64>Optional provider read-idle timeout. None permits intentionally held streams.
upstream_chat_path: StringChat-completions path appended to upstream_url. Override for
providers with non-standard layouts (Azure deployments, Gemini’s
OpenAI-compatible surface).
upstream_api_key_env: Option<String>Name of an environment variable holding the upstream API key. The key value itself never appears in this file or on the command line.
upstream_api_key_file: Option<String>File containing the upstream API key (owner-only permissions are
enforced on Unix). Mutually exclusive with upstream_api_key_env.
upstream_auth_header: StringHeader carrying the upstream API key, e.g. authorization (OpenAI),
api-key (Azure), or x-api-key.
upstream_auth_scheme: StringPrefix inserted before the key in the auth header. "Bearer" yields
Bearer <key>; an empty string sends the raw key (Azure style).
Forward each client’s own Authorization header to the upstream
instead of injecting a server-side key. Incompatible with
require_identity (the header would carry the NHI token) and with
the static key options above.
tool_upstream_bearer_env: Option<String>Name of an environment variable holding a bearer token for
tool_upstream_url requests.
tool_upstream_bearer_file: Option<String>File containing a bearer token for tool_upstream_url requests
(owner-only permissions enforced on Unix).
require_identity: boolIdentity enforcement. When false (dev), requests without a token get
an anonymous identity; when true, unauthenticated requests are 401s.
audience: StringDeployment audience for NHI tokens.
identity_jwks_url: Option<String>Corporate IdP JWKS endpoint for Ed25519 verification keys.
identity_jwks_refresh_s: u64JWKS refresh interval in seconds.
identity_allowed_issuers: Vec<String>Optional issuer allowlist (for example Okta or Entra tenant URLs).
identity_hmac_secret_file: Option<String>Optional file containing an HS256 development secret.
identity_hmac_kid: StringKey id assigned to the development HMAC secret.
enforce_identity_scopes: boolEnforce operation scopes on validated identities.
Round-30 F1: default flipped from true to false so it
matches the also-default-false posture of
Self::require_identity. When require_identity = false,
unauthenticated requests short-circuit to the anonymous
identity BEFORE the scope gate runs — an operator who reads
enforce_identity_scopes = true in the config would
reasonably conclude “you need the scope to reach /v1/chat”,
but in the default posture curl-with-no-header still
proceeds as anonymous. validate() now rejects the
enforce_identity_scopes = true && require_identity = false
combination outright; keeping the two defaults aligned makes
the shipped harness.example.toml and harness.container.toml
pass validate without extra changes. Operators turning on
identity enforcement in production set both flags to true
explicitly (see harness.docker.toml).
chat_scope: StringScope required for chat completion requests.
session_close_scope: StringScope required to close sessions.
session_promote_scope: StringScope required to promote unsigned sessions.
default_workflow: StringDefault workflow when X-AV-Workflow is absent: signed workflows are
opt-in by policy (brief Module G).
consequential_tools: Vec<String>Tools that require a signed workflow because they have real-world consequences.
tool_schema_dir: Option<String>Directory containing one JSON Schema per tool, named <tool>.json.
require_tool_schema: boolReject tool calls when no matching schema was loaded.
wasm_policy_paths: Vec<String>WASM or WAT policy module paths, evaluated in order.
session_idle_close_s: u64Idle seconds after which a session is swept closed.
atif_spool_dir: StringDirectory for ATIF trajectory spool files.
bridge_data_dir: StringBridge data directory (embedded broker).
bridge_backend: StringBridge backend: embedded, kafka, or nats.
bridge_manifest_path: StringDeclarative topic-schema manifest used by every Bridge backend.
bridge_endpoint: Option<String>Kafka broker (host:port[,host:port]) or NATS URL (nats:///tls://)
for network Bridge backends. Secured endpoints read their material
from the environment: AV_KAFKA_CA_FILE + AV_KAFKA_SASL_USERNAME/
AV_KAFKA_SASL_PASSWORD (+ optional AV_KAFKA_SASL_MECHANISM:
SCRAM-SHA-256 default, SCRAM-SHA-512, or PLAIN; credentials
are refused without the CA), and AV_NATS_CA_FILE (forces TLS) +
AV_NATS_USER/AV_NATS_PASSWORD.
state_backend: StringState backend: memory or redis.
state_endpoint: Option<String>Redis URL for the distributed state backend. A comma-separated list of URLs selects Redis Cluster mode.
embedder_backend: StringEmbedding backend: hash or onnx.
onnx_model_path: Option<String>Customer-supplied ONNX model path.
onnx_tokenizer_path: Option<String>Hugging Face tokenizer.json paired with the ONNX model.
onnx_dimension: usizeONNX model output width.
vector_backend: StringVector persistence backend: memory or qdrant.
qdrant_url: Option<String>Qdrant base URL.
qdrant_collection: StringQdrant collection receiving reasoning vectors.
worker_channel_capacity: usizeWorker channel capacity (bounded; overflow is counted, never blocking).
strict_stage_budget: boolStrict per-stage budget assertions (AV_STRICT_BUDGET also enables).
breaker: BreakerConfigLoop breaker configuration.
compression_enabled: boolCompression configuration.
budget: BudgetSpecToken budget per session (compression/velocity accounting).
reconcile_tick_s: u64Reconciler tick interval (seconds).
max_request_bytes: usizeMaximum request body size accepted on /v1/chat/completions and
/mcp. Defaults to 4 MiB, matching the sandbox’s MAX_PAYLOAD_BYTES
so both routes carry the same effective limit — axum’s own
DefaultBodyLimit::MAX is 2 MiB by default and would silently
reject legitimate large-context chat requests before the sandbox
even saw the payload. Operators serving very-long-context models
(Claude 200k, GPT-4 128k on maximally-verbose inputs) may need to
raise this.
dashboard_enabled: boolWhether the built-in read-only operator dashboard is enabled.
When true (the default), the harness serves:
GET /dashboard— an HTML/CSS/JS single-page dashboard,GET /dashboard/{style.css,app.js}— the bundled assets,GET /api/v1/dashboard/{stats,sessions,sessions/:id}— read-only JSON that mirrors the in-memory session registry.
The endpoints are unauthenticated: they expose the same data that
already lands on disk (receipts) and in /metrics. Front the
harness with the same ingress control you use for /metrics if
this is a concern, or set this to false to disable them.
Implementations§
Source§impl HarnessConfig
impl HarnessConfig
Sourcepub fn from_toml(s: &str) -> Result<Self, String>
pub fn from_toml(s: &str) -> Result<Self, String>
Parse from TOML, validating the version and structural sanity.
Sourcepub fn from_toml_unvalidated(s: &str) -> Result<Self, String>
pub fn from_toml_unvalidated(s: &str) -> Result<Self, String>
Parse from TOML without validating, so environment overrides can be
applied first (main validates after Self::apply_env_overrides).
Sourcepub fn builtin() -> Result<Self, String>
pub fn builtin() -> Result<Self, String>
A config of pure built-in defaults for zero-config startup. The
caller must supply upstream_url (typically AV_UPSTREAM_URL)
before validation.
Sourcepub fn uses_default_manifest_path(&self) -> bool
pub fn uses_default_manifest_path(&self) -> bool
True when bridge_manifest_path is the compiled-in default, i.e.
the operator never chose a manifest. Only then may the binary fall
back to its embedded manifest when the file is absent; an explicit
path that is missing must stay a hard error.
Sourcepub fn uses_default_tool_schema_dir(&self) -> bool
pub fn uses_default_tool_schema_dir(&self) -> bool
True when tool_schema_dir is the compiled-in default (see
Self::uses_default_manifest_path for the fallback rationale).
Sourcepub fn is_default_policy_path(path: &str) -> bool
pub fn is_default_policy_path(path: &str) -> bool
True when path is the compiled-in default WASM policy entry (see
Self::uses_default_manifest_path for the fallback rationale).
Sourcepub fn duplicated_chat_path_segment(&self) -> Option<&str>
pub fn duplicated_chat_path_segment(&self) -> Option<&str>
Detect the classic footgun of upstream_url already ending with the
first segment of upstream_chat_path (for example a base URL of
https://api.openai.com/v1 joined with /v1/chat/completions
produces /v1/v1/... and a confusing provider 404). Returns the
duplicated segment for warning messages.
Sourcepub fn apply_env_overrides(&mut self)
pub fn apply_env_overrides(&mut self)
Apply AV_* environment overrides from the process environment.
Environment beats file for these scalars (12-factor container
deployments override without editing mounted files). Key values
are still never read here — only AV_UPSTREAM_API_KEY presence
selects itself as the key source.
Sourcepub fn apply_env_overrides_from(&mut self, get: impl Fn(&str) -> Option<String>)
pub fn apply_env_overrides_from(&mut self, get: impl Fn(&str) -> Option<String>)
Testable core of Self::apply_env_overrides.
Trait Implementations§
Source§impl Clone for HarnessConfig
impl Clone for HarnessConfig
Source§fn clone(&self) -> HarnessConfig
fn clone(&self) -> HarnessConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HarnessConfig
impl Debug for HarnessConfig
Source§impl<'de> Deserialize<'de> for HarnessConfig
impl<'de> Deserialize<'de> for HarnessConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for HarnessConfig
impl RefUnwindSafe for HarnessConfig
impl Send for HarnessConfig
impl Sync for HarnessConfig
impl Unpin for HarnessConfig
impl UnsafeUnpin for HarnessConfig
impl UnwindSafe for HarnessConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more