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: usizeTotal configured MCP servers (connected + failed).
mcp_tool_count: usize§mcp_connected_count: usizeNumber 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: u64Number 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: u64Compaction probe outcomes (#1609).
compaction_probe_soft_failures: u64Compaction probe soft failures (summary borderline — compaction proceeded with warning).
compaction_probe_failures: u64Compaction probe hard failures (compaction blocked due to lossy summary).
compaction_probe_errors: u64Compaction 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: f32Configured pass threshold for the compaction probe. Used by TUI for category color-coding.
compaction_probe_hard_fail_threshold: f32Configured 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: u64Number 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: u64Injection 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: u64ML classifier hard-blocked tool outputs (enforcement_mode=block only).
classifier_tool_suspicious: u64ML classifier suspicious tool outputs (both enforcement modes).
causal_ipi_flags: u64TurnCausalAnalyzer flags: behavioral deviation detected at tool-return boundary.
vigil_flags_total: u64VIGIL pre-sanitizer flags: tool outputs matched injection patterns (any action).
vigil_blocks_total: u64VIGIL 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: u64Number of times the PII NER classifier timed out; input fell back to regex-only.
pii_ner_circuit_breaker_trips: u64Number 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: booltrue when a guardrail filter is active for this session.
guardrail_warn_mode: booltrue 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: booltrue when config.llm.cloud.enable_extended_context = true.
Never set for other providers to avoid false positives.
guidelines_version: u32Latest compression-guidelines version (0 = no guidelines yet).
guidelines_updated_at: StringISO 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: u64Number 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: StringEmbedding 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: StringVault backend identifier: “age”, “env”, or “none”.
active_channel: StringActive I/O channel name: "cli", "telegram", "tui", "discord", "slack".
bg_inflight: u64Background supervisor: inflight tasks across all classes.
bg_dropped: u64Background supervisor: total tasks dropped due to concurrency limit (all classes).
bg_completed: u64Background supervisor: total tasks completed (all classes).
bg_enrichment_inflight: u64Background supervisor: inflight enrichment tasks.
bg_telemetry_inflight: u64Background 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: boolWhether self-learning (skill evolution) is enabled.
semantic_cache_enabled: boolWhether the semantic response cache is enabled.
cache_enabled: boolWhether semantic response caching is enabled (alias for semantic_cache_enabled).
autosave_enabled: boolWhether assistant messages are auto-saved to memory.
classifier: ClassifierMetricsSnapshotClassifier p50/p95 latency metrics per task (injection, pii, feedback).
last_turn_timings: TurnTimingsLatency breakdown for the most recently completed agent turn.
avg_turn_timings: TurnTimingsRolling average of per-phase latency over the last 10 turns.
max_turn_timings: TurnTimingsMaximum 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: u64Number of turns included in avg_turn_timings and max_turn_timings (capped at 10).
egress_requests_total: u64Total egress (outbound HTTP) requests attempted this session.
egress_dropped_total: u64Egress events dropped due to bounded channel backpressure.
egress_blocked_total: u64Egress requests blocked by scheme/domain/SSRF policy.
context_max_tokens: u64Runtime-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: u64Token count at the time the most recent compaction was triggered. 0 = never compacted.
compaction_last_after: u64Token count after the most recent compaction completed. 0 = never compacted.
compaction_last_at_ms: u64Unix epoch milliseconds when the most recent compaction occurred. 0 = never compacted.
Trait Implementations§
Source§impl Clone for MetricsSnapshot
impl Clone for MetricsSnapshot
Source§fn clone(&self) -> MetricsSnapshot
fn clone(&self) -> MetricsSnapshot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetricsSnapshot
impl Debug for MetricsSnapshot
Source§impl Default for MetricsSnapshot
impl Default for MetricsSnapshot
Source§fn default() -> MetricsSnapshot
fn default() -> MetricsSnapshot
Auto Trait Implementations§
impl Freeze for MetricsSnapshot
impl RefUnwindSafe for MetricsSnapshot
impl Send for MetricsSnapshot
impl Sync for MetricsSnapshot
impl Unpin for MetricsSnapshot
impl UnsafeUnpin for MetricsSnapshot
impl UnwindSafe for MetricsSnapshot
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request