Skip to main content

MetricsSnapshot

Struct MetricsSnapshot 

Source
pub struct MetricsSnapshot {
Show 127 fields pub prompt_tokens: u64, pub completion_tokens: u64, pub total_tokens: u64, pub context_tokens: u64, pub api_calls: u64, pub active_skills: Vec<String>, pub total_skills: usize, pub mcp_server_count: usize, pub mcp_tool_count: usize, pub mcp_connected_count: usize, pub mcp_servers: Vec<McpServerStatus>, pub active_mcp_tools: Vec<String>, pub sqlite_message_count: u64, pub sqlite_conversation_id: Option<ConversationId>, pub qdrant_available: bool, pub vector_backend: String, pub embeddings_generated: u64, pub last_llm_latency_ms: u64, pub uptime_seconds: u64, pub provider_name: String, pub model_name: String, pub summaries_count: u64, pub context_compactions: u64, pub compaction_hard_count: u64, pub compaction_turns_after_hard: Vec<u64>, pub compression_events: u64, pub compression_tokens_saved: u64, pub tool_output_prunes: u64, pub compaction_probe_passes: u64, pub compaction_probe_soft_failures: u64, pub compaction_probe_failures: u64, pub compaction_probe_errors: u64, pub last_probe_verdict: Option<ProbeVerdict>, pub last_probe_score: Option<f32>, pub last_probe_category_scores: Option<Vec<CategoryScore>>, pub compaction_probe_threshold: f32, pub compaction_probe_hard_fail_threshold: f32, pub cache_read_tokens: u64, pub cache_creation_tokens: u64, pub cost_spent_cents: f64, pub cost_cps_cents: Option<f64>, pub cost_successful_tasks: u64, pub provider_cost_breakdown: Vec<(String, ProviderUsage)>, pub filter_raw_tokens: u64, pub filter_saved_tokens: u64, pub filter_applications: u64, pub filter_total_commands: u64, pub filter_filtered_commands: u64, pub filter_confidence_full: u64, pub filter_confidence_partial: u64, pub filter_confidence_fallback: u64, pub cancellations: u64, pub server_compaction_events: u64, pub sanitizer_runs: u64, pub sanitizer_injection_flags: u64, pub sanitizer_injection_fp_local: u64, pub sanitizer_truncations: u64, pub quarantine_invocations: u64, pub quarantine_failures: u64, pub classifier_tool_blocks: u64, pub classifier_tool_suspicious: u64, pub causal_ipi_flags: u64, pub vigil_flags_total: u64, pub vigil_blocks_total: u64, pub exfiltration_images_blocked: u64, pub exfiltration_tool_urls_flagged: u64, pub exfiltration_memory_guards: u64, pub pii_scrub_count: u64, pub pii_ner_timeouts: u64, pub pii_ner_circuit_breaker_trips: u64, pub memory_validation_failures: u64, pub rate_limit_trips: u64, pub pre_execution_blocks: u64, pub pre_execution_warnings: u64, pub guardrail_enabled: bool, pub guardrail_warn_mode: bool, pub sub_agents: Vec<SubAgentMetrics>, pub skill_confidence: Vec<SkillConfidence>, pub scheduled_tasks: Vec<[String; 4]>, pub router_thompson_stats: Vec<(String, f64, f64)>, pub security_events: VecDeque<SecurityEvent>, pub orchestration: OrchestrationMetrics, pub orchestration_graph: Option<TaskGraphSnapshot>, pub graph_community_detection_failures: u64, pub graph_entities_total: u64, pub graph_edges_total: u64, pub graph_communities_total: u64, pub graph_extraction_count: u64, pub graph_extraction_failures: u64, pub extended_context: bool, pub guidelines_version: u32, pub guidelines_updated_at: String, pub tool_cache_hits: u64, pub tool_cache_misses: u64, pub tool_cache_entries: usize, pub semantic_fact_count: u64, pub stt_model: Option<String>, pub compaction_model: Option<String>, pub provider_temperature: Option<f32>, pub provider_top_p: Option<f32>, pub embedding_model: String, pub token_budget: Option<u64>, pub compaction_threshold: Option<u32>, pub vault_backend: String, pub active_channel: String, pub bg_inflight: u64, pub bg_dropped: u64, pub bg_completed: u64, pub bg_enrichment_inflight: u64, pub bg_telemetry_inflight: u64, pub shell_background_runs: Vec<ShellBackgroundRunRow>, pub self_learning_enabled: bool, pub semantic_cache_enabled: bool, pub cache_enabled: bool, pub autosave_enabled: bool, pub classifier: ClassifierMetricsSnapshot, pub last_turn_timings: TurnTimings, pub avg_turn_timings: TurnTimings, pub max_turn_timings: TurnTimings, pub timing_sample_count: u64, pub egress_requests_total: u64, pub egress_dropped_total: u64, pub egress_blocked_total: u64, pub context_max_tokens: u64, pub compaction_last_before: u64, pub compaction_last_after: u64, pub compaction_last_at_ms: u64,
}
Expand description

Live snapshot of agent metrics broadcast via a tokio::sync::watch channel.

Fields are updated at different rates: some once at startup (static), others every turn (dynamic). For fields that are known at agent startup and do not change during the session, use StaticMetricsInit and AgentBuilder::with_static_metrics instead of adding a raw send_modify call in the runner.

Fields§

§prompt_tokens: u64§completion_tokens: u64§total_tokens: u64§context_tokens: u64§api_calls: u64§active_skills: Vec<String>§total_skills: usize§mcp_server_count: usize

Total configured MCP servers (connected + failed).

§mcp_tool_count: usize§mcp_connected_count: usize

Number of successfully connected MCP servers.

§mcp_servers: Vec<McpServerStatus>

Per-server connection status list.

§active_mcp_tools: Vec<String>§sqlite_message_count: u64§sqlite_conversation_id: Option<ConversationId>§qdrant_available: bool§vector_backend: String§embeddings_generated: u64§last_llm_latency_ms: u64§uptime_seconds: u64§provider_name: String§model_name: String§summaries_count: u64§context_compactions: u64§compaction_hard_count: u64

Number of times the agent entered the Hard compaction tier, including cooldown-skipped turns. Not equal to the actual LLM summarization count — reflects pressure, not action.

§compaction_turns_after_hard: Vec<u64>

User-message turns elapsed after each hard compaction event. Entry i = turns between hard compaction i and hard compaction i+1 (or session end). Empty when no hard compaction occurred during the session.

§compression_events: u64§compression_tokens_saved: u64§tool_output_prunes: u64§compaction_probe_passes: u64

Compaction probe outcomes (#1609).

§compaction_probe_soft_failures: u64

Compaction probe soft failures (summary borderline — compaction proceeded with warning).

§compaction_probe_failures: u64

Compaction probe hard failures (compaction blocked due to lossy summary).

§compaction_probe_errors: u64

Compaction probe errors (LLM/timeout — non-blocking, compaction proceeded).

§last_probe_verdict: Option<ProbeVerdict>

Last compaction probe verdict. None before the first probe completes.

§last_probe_score: Option<f32>

Last compaction probe score in [0.0, 1.0]. None before the first probe completes or after an Error verdict (errors produce no score).

§last_probe_category_scores: Option<Vec<CategoryScore>>

Per-category scores from the last completed probe.

§compaction_probe_threshold: f32

Configured pass threshold for the compaction probe. Used by TUI for category color-coding.

§compaction_probe_hard_fail_threshold: f32

Configured hard-fail threshold for the compaction probe.

§cache_read_tokens: u64§cache_creation_tokens: u64§cost_spent_cents: f64§cost_cps_cents: Option<f64>

Cost per successful task in cents. None until at least one task completes.

§cost_successful_tasks: u64

Number of successful tasks recorded today.

§provider_cost_breakdown: Vec<(String, ProviderUsage)>

Per-provider cost breakdown, sorted by cost descending.

§filter_raw_tokens: u64§filter_saved_tokens: u64§filter_applications: u64§filter_total_commands: u64§filter_filtered_commands: u64§filter_confidence_full: u64§filter_confidence_partial: u64§filter_confidence_fallback: u64§cancellations: u64§server_compaction_events: u64§sanitizer_runs: u64§sanitizer_injection_flags: u64§sanitizer_injection_fp_local: u64

Injection pattern hits on ToolResult (local) sources — likely false positives.

Counts regex hits that fired on content from shell, read_file, search_code, etc. These sources are user-owned and not adversarial; a non-zero value indicates a pattern that needs tightening or a source reclassification.

§sanitizer_truncations: u64§quarantine_invocations: u64§quarantine_failures: u64§classifier_tool_blocks: u64

ML classifier hard-blocked tool outputs (enforcement_mode=block only).

§classifier_tool_suspicious: u64

ML classifier suspicious tool outputs (both enforcement modes).

§causal_ipi_flags: u64

TurnCausalAnalyzer flags: behavioral deviation detected at tool-return boundary.

§vigil_flags_total: u64

VIGIL pre-sanitizer flags: tool outputs matched injection patterns (any action).

§vigil_blocks_total: u64

VIGIL pre-sanitizer blocks: tool outputs replaced with sentinel (strict_mode=true).

§exfiltration_images_blocked: u64§exfiltration_tool_urls_flagged: u64§exfiltration_memory_guards: u64§pii_scrub_count: u64§pii_ner_timeouts: u64

Number of times the PII NER classifier timed out; input fell back to regex-only.

§pii_ner_circuit_breaker_trips: u64

Number of times the PII NER circuit breaker tripped (disabled NER for the session).

§memory_validation_failures: u64§rate_limit_trips: u64§pre_execution_blocks: u64§pre_execution_warnings: u64§guardrail_enabled: bool

true when a guardrail filter is active for this session.

§guardrail_warn_mode: bool

true when guardrail is in warn-only mode (action = warn).

§sub_agents: Vec<SubAgentMetrics>§skill_confidence: Vec<SkillConfidence>§scheduled_tasks: Vec<[String; 4]>

Scheduled task summaries: [name, kind, mode, next_run].

§router_thompson_stats: Vec<(String, f64, f64)>

Thompson Sampling distribution snapshots: (provider, alpha, beta).

§security_events: VecDeque<SecurityEvent>

Ring buffer of recent security events (cap 100, FIFO eviction).

§orchestration: OrchestrationMetrics§orchestration_graph: Option<TaskGraphSnapshot>

Live snapshot of the currently active task graph. None when no plan is active.

§graph_community_detection_failures: u64§graph_entities_total: u64§graph_edges_total: u64§graph_communities_total: u64§graph_extraction_count: u64§graph_extraction_failures: u64§extended_context: bool

true when config.llm.cloud.enable_extended_context = true. Never set for other providers to avoid false positives.

§guidelines_version: u32

Latest compression-guidelines version (0 = no guidelines yet).

§guidelines_updated_at: String

ISO 8601 timestamp of the latest guidelines update (empty if none).

§tool_cache_hits: u64§tool_cache_misses: u64§tool_cache_entries: usize§semantic_fact_count: u64

Number of semantic-tier facts in memory (0 when tier promotion disabled).

§stt_model: Option<String>

STT model name (e.g. “whisper-1”). None when STT is not configured.

§compaction_model: Option<String>

Model used for context compaction/summarization. None when no summary provider is set.

§provider_temperature: Option<f32>

Temperature of the active provider when using Candle. None for API providers.

§provider_top_p: Option<f32>

Top-p of the active provider when using Candle. None for API providers.

§embedding_model: String

Embedding model name (e.g. "nomic-embed-text"). Empty when embeddings are disabled.

§token_budget: Option<u64>

Token budget for context window. None when not configured.

§compaction_threshold: Option<u32>

Token threshold that triggers soft compaction. None when not configured.

§vault_backend: String

Vault backend identifier: “age”, “env”, or “none”.

§active_channel: String

Active I/O channel name: "cli", "telegram", "tui", "discord", "slack".

§bg_inflight: u64

Background supervisor: inflight tasks across all classes.

§bg_dropped: u64

Background supervisor: total tasks dropped due to concurrency limit (all classes).

§bg_completed: u64

Background supervisor: total tasks completed (all classes).

§bg_enrichment_inflight: u64

Background supervisor: inflight enrichment tasks.

§bg_telemetry_inflight: u64

Background supervisor: inflight telemetry tasks.

§shell_background_runs: Vec<ShellBackgroundRunRow>

In-flight background shell runs. Empty when none are running or no ShellExecutor is wired.

§self_learning_enabled: bool

Whether self-learning (skill evolution) is enabled.

§semantic_cache_enabled: bool

Whether the semantic response cache is enabled.

§cache_enabled: bool

Whether semantic response caching is enabled (alias for semantic_cache_enabled).

§autosave_enabled: bool

Whether assistant messages are auto-saved to memory.

§classifier: ClassifierMetricsSnapshot

Classifier p50/p95 latency metrics per task (injection, pii, feedback).

§last_turn_timings: TurnTimings

Latency breakdown for the most recently completed agent turn.

§avg_turn_timings: TurnTimings

Rolling average of per-phase latency over the last 10 turns.

§max_turn_timings: TurnTimings

Maximum per-phase latency observed within the rolling window (tail-latency visibility).

M3: exposes max_in_window alongside the rolling average for operational monitoring.

§timing_sample_count: u64

Number of turns included in avg_turn_timings and max_turn_timings (capped at 10).

§egress_requests_total: u64

Total egress (outbound HTTP) requests attempted this session.

§egress_dropped_total: u64

Egress events dropped due to bounded channel backpressure.

§egress_blocked_total: u64

Egress requests blocked by scheme/domain/SSRF policy.

§context_max_tokens: u64

Runtime-resolved context window limit (tokens).

Populated from resolve_context_budget after provider pool construction and refreshed on every /provider switch. 0 means unknown (pre-init or provider has no declared window); the TUI gauge renders "—" in this case to avoid divide-by-zero.

§compaction_last_before: u64

Token count at the time the most recent compaction was triggered. 0 = never compacted.

§compaction_last_after: u64

Token count after the most recent compaction completed. 0 = never compacted.

§compaction_last_at_ms: u64

Unix epoch milliseconds when the most recent compaction occurred. 0 = never compacted.

Trait Implementations§

Source§

impl Clone for MetricsSnapshot

Source§

fn clone(&self) -> MetricsSnapshot

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MetricsSnapshot

Source§

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

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

impl Default for MetricsSnapshot

Source§

fn default() -> MetricsSnapshot

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

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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