How It Works
Explore Ketos Agent’s end-to-end data flow, zero-disk-write memory buffering, two-stage full-context capture, and anti-flapping state machine (click any diagram to zoom and pan).
1. End-to-End Data Flow (Zero Steady-State Writes, Full Context on Incident)
Section titled “1. End-to-End Data Flow (Zero Steady-State Writes, Full Context on Incident)”flowchart TB subgraph CFG["Configuration & Lossless Hot Reload"] YAML["config.yml (global / inputs / alerts / storage)"] RELOAD["Auto Watch & SIGHUP Atomic Hot Reload"] YAML --> RELOAD end
subgraph INPUT["Four-Pillar Integrations"] C1["Host & Process Forensics (inputs.host)"] C2["Application Logs (inputs.log_file)"] C3["APM OTLP Traces & RED (inputs.apm)"] C4["HTTP Availability Probe (inputs.http_probe)"] end
subgraph MEM["Bounded Local Memory Buffers (Anti-OOM · 0 Disk I/O)"] MB["Metrics · Logs · Traces Ring Buffers"] end
subgraph ALERT["Edge Rule Engine"] SCHED["On-Demand Evaluation (Zero-Cost Skip on Unchanged Signals)"] DET["Cross-Metric Aggregations · Log/Trace Counters · Causal Sequences"] SM["Anti-Flapping State Machine (for / resolve_for / repeat)"] SCHED --> DET --> SM end
subgraph CAPTURE["Full-Context Incident Capture Engine"] SCOPE["Auto-Scoped Instances + Optional attach + trace_id Correlation"] SNAPW["Two-Stage Async Capture (T0 partial -> wait after -> complete)"] SCOPE --> SNAPW end
subgraph OUT["AI-Native Output"] SNAPFS["Atomic Local Storage data/snapshots/.../*.md (Dual Hard FIFO)"] CLOUD["Optional On-Demand Sync to Ketos Cloud (Automated AI RCA)"] end
C1 --> MB C2 --> MB C3 --> MB C4 --> MB RELOAD -.->|"Hot-update rules (keep memory intact)"| SCHED MB -->|"Low-overhead read-only evaluation"| DET MB -->|"Extract Pre/Post Metrics + Logs + Traces"| SNAPW SM -->|"Firing / Resolved transitions"| SCOPE SNAPW -->|"Atomic write"| SNAPFS SNAPFS -.->|"Optional Cloud Mode"| CLOUD2. Incident Trigger & Two-Stage Full-Context Sequence
Section titled “2. Incident Trigger & Two-Stage Full-Context Sequence”sequenceDiagram participant Col as Integrations (Host / Log / APM / Probe) participant Mem as Bounded Local Memory participant AE as Edge Rule Engine participant Snap as Context Capturer participant FS as Local Filesystem
loop Steady-State Collection Col->>Mem: Append latest metrics / logs / spans (in-memory only, 0 disk I/O) end
loop Rule Evaluation (e.g. every 1s) AE->>Mem: Low-overhead read-only evaluation Note over AE: Condition holds for >= for -> Firing AE-->>Snap: Submit capture request (auto-coalesces concurrent events) Snap->>Snap: Auto-infer target instances (+ optional attach) Snap->>Mem: Freeze pre-trigger window (before) metrics, logs & traces Snap->>Col: Capture T0 live forensics (Top processes / stuck mounts) Snap->>FS: Stage 1: Atomic write status=partial (power-loss safe) Snap->>Snap: Wait post-trigger window (after) for cascades & late child spans Snap->>Mem: Extract post-window data & correlate logs via trace_id Snap->>FS: Stage 2: Reserve quota & atomically update to status=complete end3. Anti-Flapping State Machine & Hot-Reload Lifecycle
Section titled “3. Anti-Flapping State Machine & Hot-Reload Lifecycle”stateDiagram-v2 [*] --> Idle
Idle --> Pending: Condition matched (start trigger debounce) Pending --> Idle: Condition cleared (reset debounce) Pending --> Firing: Held >= for (emit Firing & assign incident_id)
Firing --> Firing: Held >= repeat (optional periodic re-capture) Firing --> Recovering: Condition cleared (including threshold raised via hot reload)
Recovering --> Firing: Condition re-triggered (suppress flapping) Recovering --> Idle: Clear >= resolve_for (emit Resolved)Security & Resource Limits {#evidence-limits}
Section titled “Security & Resource Limits {#evidence-limits}”For detailed specifications on memory ceilings, dual hard FIFO disk quotas, power-loss recovery, log polling caps, and OTLP concurrency protection, see Security & Resource Limits.