Autonomous AI SRE Agent with Production-Grade Safety — Hybrid RCA engine (rules + LLM), policy-based action gating, post-remediation verification, and automatic rollback. Built for Kubernetes with deterministic safety layers.
From Proof-of-Concept → Production-Ready System
All 9 RCA patterns validated with real chaos injection and actual log output:
- Refactored Architecture: Monolithic chaos handler → 8 focused modules (memory, CPU, latency, error, goroutine leak, status, reset)
- New Endpoint:
/chaos/goroutine-leak- Intentional resource leak for Pattern 8 validation (existing/chaos/cpuproperly cleans up) - Real Dependency Testing: Optional Postgres/Redis health checks for Pattern 6 validation (docker stop tests with actual stdlib error messages)
- 100% Backward Compatible: All existing endpoints, metrics, and log patterns preserved
- Automated Validation: Docker Compose test stack + validation script for continuous verification
Documentation: See PHASE_A4_COMPLETE_VALIDATION.md for full test results
| Feature | V1 | V2 |
|---|---|---|
| RCA Method | 100% LLM (2-5s, $0.01/incident) | 60% Rules (<50ms, free) + 40% LLM |
| Safety Layers | 1 (confidence threshold) | 6 layers (rules→policy→approval→verify→rollback) |
| Cost | $6/month (1000 incidents) | $2.40/month (60% reduction) |
| Reliability | Fails if Claude API down | Works offline (rules layer) |
| Observability | Basic logging | Full telemetry (rca_method tracking) |
| Multi-Agent | In-memory state | Redis-backed (distributed safe) |
| Tests | 81 tests | 280 tests (100% passing) |
| Verification | None | Auto-rollback if metrics don't improve |
| Incident Storage | None | Postgres + Redis (queryable analytics) |
| Trust Metrics | None | Override tracking (human feedback loop) |
| RAG Investigation | None | Similarity search (learn from past incidents) |
| Validation Data | Synthetic chaos only | Real traffic (GitHub Events API) |
┌────────────────────────────────────────────────────────────────────────────┐
│ AETHER-GUARD V2 ARCHITECTURE │
│ │
│ Alert Fired │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Layer 1: RULE ENGINE (30-50ms, 60% of incidents) │ │
│ │ • 7 deterministic patterns (OOM, restart loop, etc.) │ │
│ │ • Confidence scoring (0.75-0.95) │ │
│ │ • Evidence-based reasoning │ │
│ └──────────────────┬───────────────────────────────────────┘ │
│ │ No high-confidence match? │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Layer 2: RAG-AUGMENTED LLM (2-5s, 40% of incidents) │ │
│ │ • pgvector similarity search (retrieve 5 similar cases) │ │
│ │ • Multi-step investigation graph (LangGraph) │ │
│ │ • Claude Sonnet 4.5 for ambiguous cases │ │
│ │ • Structured JSON output with citations │ │
│ └──────────────────┬───────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Layer 3: POLICY ENGINE │ │
│ │ • Action allowlist/denylist matrix │ │
│ │ • Time-of-day gating (business hours check) │ │
│ │ • Risk assessment (LOW/MEDIUM/HIGH/CRITICAL) │ │
│ │ • Blast radius limits (1/3/5/unlimited pods) │ │
│ └──────────────────┬───────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Layer 4: APPROVAL GATE (High/Critical risk only) │ │
│ │ • Slack notification (interactive approval) │ │
│ │ • 5-minute timeout (auto-deny) │ │
│ │ • Audit trail in SQLite/etcd │ │
│ └──────────────────┬───────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Layer 5: EXECUTION │ │
│ │ • Metrics capture (before state) │ │
│ │ • Execute: RESTART / SCALE / ROLLBACK │ │
│ │ • Cooldown: 5-min per-container (Redis-backed) │ │
│ └──────────────────┬───────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Layer 6: VERIFICATION + AUTO-ROLLBACK │ │
│ │ • Wait 2 minutes (metric stabilization) │ │
│ │ • Compare: error_rate, latency_p99 │ │
│ │ • Rollback if metrics didn't improve ≥50% │ │
│ │ • Success: Generate blameless post-mortem │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ Supporting Infrastructure: │
│ • Redis: Distributed state (cooldown, approval tracking) │
│ • Replay Framework: Golden dataset for accuracy measurement │
│ • Prometheus Metrics: rca_method, policy_decision, verification_result │
└────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ AETHER-GUARD STACK │
│ │
│ ┌──────────────────┐ scrape/5s ┌──────────────────────────┐ │
│ │ target-service │◄──────────────│ Prometheus │ │
│ │ (Go, :8080) │ │ (:9090) │ │
│ │ │ scrape/15s │ • SLO recording rules │ │
│ │ Chaos Endpoints:│ ┌───────────│ • Multi-burn-rate alerts│ │
│ │ /chaos/memleak │ │ └──────────┬───────────────┘ │
│ │ /chaos/latency │ │ │ alert fired │
│ │ /chaos/error │ │ ┌──────────▼───────────────┐ │
│ │ │ │ │ Alertmanager │ │
│ │ Golden Signals: │ │ │ (:9093) │ │
│ │ • request_rate │ │ │ • Routing + inhibitions │ │
│ │ • error_ratio │ │ └──────────┬───────────────┘ │
│ │ • p99_latency │ │ │ POST /webhook │
│ │ • mem_leak_bytes│ │ ┌──────────▼───────────────┐ │
│ └──────────────────┘ │ │ Listener │ │
│ │ │ (Python/FastAPI, :8081) │ │
│ ┌──────────────────┐ │ │ • Enriches alert with: │ │
│ │ event-tracker │◄──┘ │ - Prometheus metrics │ │
│ │ (Go, :8083) │ │ - Docker container logs│ │
│ │ │ └──────────┬───────────────┘ │
│ │ Real Traffic: │ ┌──────────────────────────────────────┐ │
│ │ • GitHub Events │ │ Redis │ │
│ │ • 2min polling │ │ (:6379) │ │
│ └──────────────────┘ │ • Cooldown state │ │
│ │ • Approval queue │ │
│ └────────────┬─────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────┐ │
│ │ AI SRE Agent (V2) │ │
│ │ (Python/FastAPI, :8082) │ │
│ │ │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ Rule Engine │ │ │
│ │ │ (7 patterns) │ │ │
│ │ └──────┬──────────────┘ │ │
│ │ ↓ fallback │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ Claude AI │ │ │
│ │ │ (Sonnet 4.5) │ │ │
│ │ └──────┬──────────────┘ │ │
│ │ ↓ │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ Policy Engine │ │ │
│ │ └──────┬──────────────┘ │ │
│ │ ↓ │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ Verification Engine │ │ │
│ │ │ + Auto-Rollback │ │ │
│ │ └──────┬──────────────┘ │ │
│ │ ↓ │ │
│ │ Post-Mortem Generator ───────────────┼──►│── postmortems/*.md
│ └───────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
Metric breach → Prometheus rule fires (15s eval) →
Alertmanager routes (5s group_wait for CRITICAL) →
Listener enriches (metrics snapshot + 100 log lines) →
Agent polls (10s) →
┌─ Rule Engine attempts match (30-50ms)
│ ├─ High confidence (≥0.85)? → Use rule action ✅
│ └─ No match/Low confidence? → Claude API (2-5s) ✅
↓
Policy Engine checks (blocks forbidden actions) →
High-risk? → Slack approval gate (5 min timeout) →
Execution (capture metrics before) →
Wait 2 minutes (stabilization) →
Verification (compare error_rate, latency) →
├─ Improved ≥50%? → Success ✅
└─ No improvement? → Auto-Rollback ⚠️ →
Post-mortem generated (Markdown)
aether-guard/
├── services/
│ ├── target-service/ # Go microservice with chaos endpoints
│ │ ├── cmd/server/main.go
│ │ └── internal/
│ │ ├── chaos/ # MemLeak, Latency, Error injection + tests
│ │ ├── handlers/ # /api/users, /api/orders, /health + tests
│ │ └── metrics/ # Prometheus instruments + middleware + tests
│ ├── listener/ # Python alert enrichment service
│ │ ├── listener.py # FastAPI webhook + Prometheus + Docker log fetch
│ │ ├── alert_summary.py # Daily Telegram summaries
│ │ └── tests/ # 14 pytest unit tests
│ ├── event-tracker/ # Priority 9: Real-traffic validation (Go)
│ │ ├── cmd/server/main.go # HTTP server + background poller
│ │ ├── internal/
│ │ │ ├── github/ # GitHub Events API client + cache
│ │ │ ├── handlers/ # JSON API + health + HTML page
│ │ │ └── metrics/ # Prometheus instruments (GitHub API monitoring)
│ │ └── Dockerfile
│ └── agent/ # Python AI SRE agent (V2)
│ ├── agent.py # Hybrid RCA pipeline + FastAPI endpoints
│ ├── prompt.py # Claude system prompt + context builder
│ ├── remediation.py # Docker SDK remediation (Redis cooldown)
│ ├── postmortem.py # Blameless post-mortem generator
│ │
│ │ ── V2 Core Modules ───────────────────────────────
│ ├── rules.py # ⚡ Rule-based triage (7 patterns, <50ms)
│ ├── policy.py # 🛡️ Action gating + risk assessment
│ ├── verification.py # ✅ Post-remediation validation + rollback
│ ├── replay.py # 📊 Incident replay framework
│ ├── trend_analysis.py # 📈 Time-series trend detection (Priority 3)
│ ├── enrichment.py # 🔍 Metric enrichment (Prometheus queries)
│ │
│ │ ── Priority 2: Trust Metrics & Analytics ──────────
│ ├── incident_report.py # 📊 Structured incident reports (5 outcome categories)
│ ├── incident_storage.py # 💾 Postgres + Redis persistence + pgvector
│ ├── metrics.py # 📉 Prometheus exporter (trust metrics)
│ │
│ │ ── Priority 8: RAG-Augmented Investigation ────────
│ ├── embedding.py # 🧠 Voyage AI embedding generation
│ ├── investigation_graph.py # 🔄 Multi-step RAG graph (LangGraph)
│ │
│ └── tests/ # 🧪 239 pytest unit tests (100% passing)
│ ├── test_postmortem.py # 45 tests (post-mortem generation)
│ ├── test_policy.py # 36 tests (policy matrix, time gates)
│ ├── test_rules.py # 33 tests (all 7 rule patterns)
│ ├── test_verification.py # 23 tests (metric validation, rollback)
│ ├── test_parse_validate.py # 21 tests (alert parsing, validation)
│ ├── test_remediation.py # 13 tests (cooldown, Redis fallback)
│ ├── test_incident_report.py # 11 tests (Priority 2: outcome taxonomy)
│ ├── test_trend_based_patterns.py # 11 tests (trend analysis)
│ ├── test_webhook.py # 10 tests (listener integration)
│ ├── test_goroutine_leak.py # 9 tests (Priority 3: leak detection)
│ ├── test_embedding.py # 9 tests (Priority 8: RAG + pgvector)
│ ├── test_override.py # 8 tests (Priority 2: human overrides)
│ ├── test_tracing.py # 7 tests (OpenTelemetry tracing)
│ ├── test_benchmark_tracing.py # 2 tests (tracing benchmarks)
│ └── test_benchmark_real_tempo.py # 1 test (Tempo integration)
│
├── infra/
│ ├── docker-compose.yml # Full 7-service stack (+ Redis)
│ ├── docker-compose.prod.yml # Production overrides
│ ├── prometheus/
│ │ ├── prometheus.yml # Scrape config + alerting stanza
│ │ └── rules/slo_alerts.yml # 5 SLO-based alert rules + recording rules
│ ├── alertmanager/
│ │ └── alertmanager.yml # Routing + inhibit rules
│ └── grafana/ # Auto-provisioned SLO dashboard (21 panels)
│ ├── provisioning/
│ └── dashboards/
├── k8s/ # Production Kubernetes manifests (Kustomize)
│ ├── namespace.yaml
│ ├── target-service.yaml # Deployment + Service + HPA (2→10 pods)
│ ├── prometheus.yaml # RBAC + ConfigMap + PVC + Deployment
│ ├── alertmanager.yaml
│ ├── listener.yaml
│ ├── agent.yaml # Secret + PVC + Deployment
│ ├── grafana.yaml
│ └── kustomization.yaml
├── docs/
│ ├── ARCHITECTURE_V2.md # 📖 V2 design decisions & architecture
│ ├── TRANSFORMATION_PLAN.md # 📋 V1→V2 migration roadmap
│ └── runbooks/ # SRE runbooks for all 5 alert types
│ ├── high-error-rate.md
│ ├── high-latency.md
│ ├── memory-leak.md
│ └── service-down.md
├── scripts/
│ ├── load_gen.py # Traffic generator with chaos scenarios
│ ├── generate_postmortem.py # Standalone post-mortem CLI
│ ├── trigger_incidents.sh # Test incident generator (OOM, 503, goroutine leak, etc.)
│ ├── backfill_embeddings.py # Priority 8: Generate embeddings for existing incidents
│ └── deploy.sh # Production deployment script
├── postmortems/ # Auto-generated blameless post-mortems
├── .github/workflows/
│ ├── ci.yml # ✅ 6-job CI pipeline (all passing)
│ └── cd.yml # 🚀 Automated deployment to VPS
├── .env.example # Environment variable template
└── README_V2.md # V2 detailed documentation
- Docker Desktop (or Docker Engine + Compose plugin)
- Python 3.11+ (for local scripts only)
- LLM API Key (choose one):
- Anthropic API key for Claude (default)
- OpenAI API key for GPT-4/GPT-4-turbo/o1
git clone https://github.com/jnzm02/Aether-guard.git
cd Aether-guard
cp .env.example .env
# Edit .env — add your API keyFor Anthropic (Claude) — default:
# In .env
LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-...For OpenAI (GPT-4):
# In .env
LLM_PROVIDER=openai
OPENAI_API_KEY=sk-...
# OPENAI_MODEL=gpt-4-turbo-2024-04-09 # Optional, defaults to gpt-4-turbomake docker-upAll 7 services start in dependency order (target-service, prometheus, alertmanager, redis, listener, grafana, agent). Verify:
make health-check # checks all /health endpoints| Service | URL |
|---|---|
| Grafana | http://localhost:3001 (admin / aether-guard) |
| Prometheus | http://localhost:9090 |
| Alertmanager | http://localhost:9093 |
| Redis | localhost:6379 |
| Alert Listener | http://localhost:8081/docs |
| AI Agent | http://localhost:8082/docs |
| Target Service | http://localhost:8080/api/users |
# Terminal 1 — watch the agent's decision stream
make agent-logs
# Terminal 2 — inject chaos and observe V2 in action
make chaos-memleak # trigger memory leak → Rule engine matches in 35ms ⚡
make chaos-error # inject 500s → Claude analysis (LLM fallback)
make chaos-latency # add 2s delay → Policy blocks forbidden action 🛡️
# Watch the logs to see:
# 1. Rule match OR LLM analysis
# 2. Policy decision (allowed/blocked/requires approval)
# 3. Execution + metrics capture
# 4. Verification + auto-rollback (if metrics didn't improve)
make agent-analyses # view AI RCA decisions with rca_method field
make postmortem-latest # read generated blameless post-mortem
make chaos-reset # restore healthy state# Terminal 1 — watch agent logs
docker compose -f infra/docker-compose.yml logs -f agent
# Terminal 2 — trigger test scenarios
./scripts/trigger_incidents.sh
# This sends 5 different alert types to Alertmanager:
# 1. HighMemoryUsage (OOM scenario)
# 2. HighErrorRate (Rate limit 503)
# 3. DatabaseConnectionPoolExhausted
# 4. DiskSpaceCritical
# 5. HighGoroutineCount (Goroutine leak - Priority 3)
# Query incidents via API
curl http://localhost:8082/incidents | jq
# View trust metrics (Priority 2)
curl http://localhost:8082/trust-metrics | jq
# Check override tracking
curl http://localhost:8082/incidents/{incident_id} | jq{
"analysis": "Pattern matched: OOM_KILL",
"root_cause": "memory_leak",
"confidence": 0.95,
"action": "RESTART",
"reasoning": "Detected OOM kill in kernel logs. Process was terminated by OS due to memory exhaustion. RESTART is required to recover.",
"evidence": [
"2024-05-21 10:05:00 ERROR Out of memory: Kill process 1234",
"Memory usage: 2.1 GB (95% of limit)"
],
"rule_name": "OOM_KILL",
"rca_method": "rule-based", // ⚡ Fast path
"policy_decision": {
"allowed": true,
"risk_level": "LOW",
"requires_approval": false,
"reason": "RESTART action allowed for memory_leak root cause"
},
"verification": {
"success": true,
"improved": true,
"reason": "Error rate improved 87% (0.10 → 0.013), within SLO",
"should_rollback": false
}
}{
"analysis": "Dependency database timeout pattern detected with connection pool exhaustion",
"root_cause": "dependency_failure",
"confidence": 0.78,
"action": "RESTART",
"reasoning": "Connection pool to PostgreSQL is exhausted (50/50 connections in use). RESTART will clear stale connections and re-establish pool.",
"rca_method": "llm-assisted", // 🧠 Fallback for ambiguous case
"policy_decision": {
"allowed": false,
"risk_level": "HIGH",
"requires_approval": true,
"reason": "Outside business hours (current: 22:00 UTC, allowed: 09:00-18:00 UTC)"
},
"approval_status": "auto-approved-demo" // Would be Slack approval in production
}The GitHub Actions workflow (.github/workflows/ci.yml) runs on every push and PR:
go-build (build+vet+test) ─┐
python-lint ───────────────┼──► docker-build ──► integration-smoke
python-test ───────────────┤
validate-infra-config ─────┘
| Job | What it checks | Status |
|---|---|---|
go-build |
go build + go vet + go test -race (23 tests) |
✅ Passing |
python-lint |
ruff linting on agent, listener, scripts |
✅ Passing |
python-test |
pytest — 239 tests (36 policy + 23 verification + 33 rules + more) |
✅ Passing |
validate-infra-config |
promtool check config/rules + amtool check-config |
✅ Passing |
docker-build |
Builds all 3 Docker images (only runs if all 4 above pass) | ✅ Passing |
integration-smoke |
Starts full stack, hits all health endpoints, queries Prometheus | ✅ Passing |
CD Pipeline (.github/workflows/cd.yml):
- Automated deployment to DigitalOcean/VPS
- Zero-downtime rolling updates
- Health checks + automatic rollback
- Telegram notifications on success/failure
Copy .env.example to .env and fill in:
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# LLM Provider (choose Anthropic or OpenAI)
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LLM_PROVIDER=anthropic # Options: anthropic | openai (default: anthropic)
# For Anthropic (Claude) — default provider
ANTHROPIC_API_KEY=sk-ant-... # Required if LLM_PROVIDER=anthropic
CLAUDE_MODEL=claude-sonnet-4-5-20250929 # Optional (default shown)
# For OpenAI (GPT-4, GPT-4-turbo, o1)
# OPENAI_API_KEY=sk-... # Required if LLM_PROVIDER=openai
# OPENAI_MODEL=gpt-4-turbo-2024-04-09 # Optional (default shown)
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Optional: Priority 8 RAG-Augmented Investigation
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
VOYAGE_API_KEY=pa-... # Optional — Voyage AI for embeddings (enables RAG)
RAG_ENABLED=true # Enable multi-step investigation graph
RAG_MAX_ITERATIONS=2 # Hard iteration cap (prevents unbounded loops)
RAG_CONFIDENCE_THRESHOLD=0.75 # Min confidence to finalize without refinement
SIMILARITY_MIN_CONFIDENCE=0.7 # Min confidence for similarity search retrieval
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Other Configuration
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CONFIDENCE_THRESHOLD=0.75 # Min confidence to execute an action
DRY_RUN=false # Set true to skip Docker remediation calls
POLL_INTERVAL=10 # Agent polling interval (seconds)
REDIS_URL=redis://redis:6379/0 # Redis connection URL (V2)
# Service Configuration — Monitor ANY Prometheus-instrumented service
MONITORED_JOB=target-service # Must match Prometheus job_name
TARGET_CONTAINER=target-service # Docker container name for logs/remediation| Feature | Anthropic (Claude) | OpenAI (GPT-4) |
|---|---|---|
| Default Model | claude-sonnet-4-5-20250929 | gpt-4-turbo-2024-04-09 |
| Supported Models | Claude 3.x/4.x/5.x Sonnet, Opus, Haiku | GPT-4, GPT-4-turbo, GPT-4o, o1-preview, o1-mini |
| Input Cost | $3 / million tokens | $10 / million tokens |
| Output Cost | $15 / million tokens | $30 / million tokens |
| Estimated Cost (1000 incidents/month, 40% LLM) | $2.40/month | $8/month |
| JSON Mode | Prompt-based (works well) | Prompt-based (works well) |
| Context Window | 200K tokens | 128K tokens |
| Best For | Cost-efficiency, long context | Familiarity, existing integrations |
Recommendation: Use Anthropic (Claude) for production (60% cost savings). Use OpenAI if you already have credits or prefer GPT-4.
Aether-Guard works with ANY Prometheus-instrumented service, not just the bundled target-service demo.
To monitor your own service:
- Instrument your service with Prometheus metrics (see metric contract below)
- Configure Prometheus to scrape your service with a unique
job_name - Set
MONITORED_JOBandTARGET_CONTAINERenvironment variables
📖 Complete guide: docs/BRING_YOUR_OWN_SERVICE.md
Metric Contract (required for SLO alerting):
aether_guard_http_requests_total{status_code} # Counter
aether_guard_http_request_duration_seconds # Histogram
Example: Monitor a service called "my-api-service":
# .env
MONITORED_JOB=my-api-service
TARGET_CONTAINER=my-api-service
# infra/prometheus/prometheus.yml
scrape_configs:
- job_name: "my-api-service"
static_configs:
- targets: ["my-api-service:8080"]Prometheus alert rules are auto-generated from templates at container startup using envsubst.
The V2 remediation pipeline has six independent safety mechanisms:
- Rule Confidence — Only execute if pattern confidence ≥0.85
- LLM Confidence — Per-action thresholds: RESTART≥0.75, SCALE≥0.70, ROLLBACK≥0.85
- Policy Matrix — Blocks forbidden (action, root_cause) combinations
- Time-of-Day Gating — High-risk actions blocked outside business hours (09:00-18:00 UTC)
- Approval Gate — Human approval required for HIGH/CRITICAL risk (Slack notification)
- Verification + Rollback — Auto-rollback if metrics don't improve ≥50% (error_rate or latency_p99)
Plus:
- Cooldown — 5-minute per-container cooldown (Redis-backed, prevents remediation storms)
- Dry-run mode —
DRY_RUN=truelogs actions without executing any Docker calls - Blast radius limits — LOW=1 pod, MEDIUM=3 pods, HIGH=5 pods, CRITICAL=unlimited
280 tests across Go and Python, all running in CI and 100% passing.
# Go — 27 tests (target-service: 14 tests, event-tracker: 3 tests, listener benchmarks: 10 tests)
cd services/target-service && go test -race ./...
cd services/event-tracker && go test -race ./...
# Python agent — 239 tests total
python3 -m pytest services/agent/tests/ -v
# Breakdown by file:
# test_postmortem.py: 45 tests (post-mortem generation)
# test_policy.py: 36 tests (policy matrix, time gates, approval logic)
# test_rules.py: 33 tests (all 7 rule patterns, confidence scoring)
# test_verification.py: 23 tests (metric validation, rollback decisions)
# test_parse_validate.py: 21 tests (alert parsing, validation)
# test_remediation.py: 13 tests (cooldown, Redis fallback, in-memory mode)
# test_incident_report.py: 11 tests (outcome taxonomy, duration calculation)
# test_trend_based_patterns.py: 11 tests (trend analysis patterns)
# test_webhook.py: 10 tests (listener integration)
# test_goroutine_leak.py: 9 tests (goroutine leak detection)
# test_embedding.py: 9 tests (Voyage AI, pgvector, similarity search)
# test_override.py: 8 tests (human override tracking, trust metrics)
# test_tracing.py: 7 tests (OpenTelemetry tracing)
# test_benchmark_tracing.py: 2 tests (tracing benchmarks)
# test_benchmark_real_tempo.py: 1 test (Tempo integration)
# Python listener — 14 tests (webhook, enrichment, queue)
python3 -m pytest services/listener/tests/ --import-mode=importlib -vTest Coverage:
- ✅ All 8 rule patterns (OOM kill, restart loop, memory leak, CPU saturation, traffic spike, dependency failure, bad deployment, goroutine leak)
- ✅ Policy matrix (50+ action/root_cause combinations)
- ✅ Time-of-day gating (business hours boundary tests)
- ✅ Verification thresholds (error rate ≥50% improvement, latency ≥30% improvement)
- ✅ Auto-rollback logic (metrics degraded scenarios)
- ✅ Incident storage (Postgres + Redis dual-write, 48h TTL)
- ✅ Override tracking (manual reversal, manual escalation, trust metrics computation)
- ✅ Trend analysis (goroutine leak detection, confidence boosters, false positive guards)
Automated CD pipeline via GitHub Actions for deploying to any VPS:
# 1. Run server setup script
curl -fsSL https://raw.githubusercontent.com/jnzm02/Aether-guard/main/scripts/setup-server.sh | sudo bash
# 2. Configure GitHub Secrets (see docs/CD-SETUP-GUIDE.md)
# 3. Trigger deployment via GitHub Actions UIFeatures:
- Zero-downtime rolling updates
- Automatic health checks & rollback
- Manual approval required
- Docker image caching for fast builds
- Backup & restore capabilities
- Telegram notifications (deployment status, health checks)
See Deployment Guide for detailed instructions.
Production-grade manifests in k8s/ — deploy with a single command:
# minikube quick start
eval $(minikube docker-env)
docker build -t aether-guard/target-service:latest services/target-service
docker build -t aether-guard/listener:latest services/listener
docker build -t aether-guard/agent:latest services/agent
kubectl create secret generic agent-secrets \
-n aether-guard --from-literal=ANTHROPIC_API_KEY=sk-ant-...
kubectl apply -k k8s/Key production features: HPA (2→10 pods on CPU), zero-downtime rolling deploys (maxUnavailable: 0), secretKeyRef for API key, liveness/readiness probes on every service, PVCs for stateful data (Prometheus 5 Gi, agent 1 Gi, Redis 1 Gi).
See k8s/README.md for full instructions, NodePort mapping, and secret management options.
| Pattern | Confidence | Signals | Action | MTTR |
|---|---|---|---|---|
| OOM_KILL | 0.95 | Kernel logs: "Out of memory: Kill process" | RESTART | 35μs |
| RESTART_LOOP | 0.92 | ≥3 restart events in logs | ROLLBACK | 48μs |
| MEMORY_LEAK | 0.88 | Memory alert + high usage + allocation warnings | RESTART | 42μs |
| CPU_SATURATION (traffic) | 0.85 | CPU >80% + traffic spike | SCALE | 38μs |
| CPU_SATURATION (efficiency) | 0.82 | CPU >80% + normal traffic | RESTART | 41μs |
| TRAFFIC_SPIKE | 0.87 | Traffic spike + errors or latency | SCALE | 45μs |
| DEPENDENCY_FAILURE | 0.75 | Connection refused/timeout/DNS errors | RESTART | 52μs |
| BAD_DEPLOYMENT | 0.78 | High errors + recent alert + startup failures | ROLLBACK | 58μs |
| GOROUTINE_LEAK (Priority 3) | 0.85 | Rising goroutine count + elevated absolute count + high R² | RESTART | 41μs |
Priority 3 Enhancement: Goroutine leak detection uses time-series trend analysis with confidence boosters (heap correlation, log warnings, traffic exclusion) to distinguish real leaks from load-driven increases.
Fallback to LLM: Any incident with <0.85 confidence or no pattern match escalates to Claude (2-5s response time).
Operational playbooks for all 5 alerts in docs/runbooks/:
| Alert | Runbook |
|---|---|
SLOErrorBudgetBurnCritical / Warning |
high-error-rate.md |
SLOLatencyP99Breach |
high-latency.md |
MemorySaturationWarning |
memory-leak.md |
TargetServiceDown |
service-down.md |
Each runbook: thresholds → mitigation commands → PromQL investigation → escalation policy → post-mortem trigger → toil-reduction recommendations.
| Layer | Technology |
|---|---|
| Monitored service | Go 1.25, prometheus/client_golang, uber/zap |
| Metrics & alerting | Prometheus 2.48, Alertmanager 0.26, Grafana 10.3 |
| Alert enrichment | Python 3.11, FastAPI, Docker SDK |
| AI RCA engine (V2) | Hybrid: Rule Engine + Claude Sonnet 4.5 |
| Policy & Safety (V2) | Policy matrix + Verification + Auto-rollback |
| State Management (V2) | Redis 7-alpine (distributed cooldown) |
| Remediation | Docker SDK (docker restart, docker update) |
| Orchestration | Docker Compose + Kubernetes (Kustomize, HPA) |
| CI/CD | GitHub Actions (6 jobs) + Automated deployment |
- Hybrid RCA engine (rules + LLM)
- Policy engine for action gating
- Verification engine with auto-rollback
- Redis for distributed state
- 280 comprehensive unit tests (100% passing)
- Incident replay framework
- CI/CD pipeline (all tests passing)
- Structured incident reports with 5 outcome categories
- Postgres + Redis dual-layer storage (long-term + fast access)
- Override tracking (manual reversal, manual escalation)
- Trust metrics API (by pattern, by outcome, override rates)
- Prometheus metrics export (incidents, overrides, outcomes)
- 19 comprehensive tests (incident reports + overrides)
- Time-series trend analysis (linear regression, R² confidence)
- Goroutine leak pattern with confidence boosters
- False positive guards (load-driven vs real leak)
- Heap correlation analysis
- Log warning detection (goroutine/deadlock keywords)
- Traffic spike exclusion
- 9 comprehensive tests (goroutine leak detection pattern)
- pgvector extension with HNSW indexing on Postgres
- Voyage AI embedding generation (voyage-3, 1024-dim)
- Similarity search (top-5 retrieval with min confidence filter)
- Multi-step investigation graph (LangGraph with hard iteration cap)
- Override field surfacing (trust metrics integration)
- Per-source graceful degradation (logs, metrics, embeddings)
- Cost/latency analysis (measured facts vs speculation)
- Backfill script for existing incidents
- 9 comprehensive tests (embedding, similarity, RAG flow)
- GitHub Events API integration (public events feed)
- Background poller with rate limit tracking (2-minute interval)
- In-memory cache with staleness handling
- Prometheus metrics matching target-service pattern
- HTTP endpoints: JSON API, health, metrics, HTML page
- Structured logging for enrichment.py compatibility
- Resilience: serves stale cache with staleness indicator on API failure
- Docker integration + Prometheus scrape configuration
- 3 Go tests (cache, client, resilience)
- Slack integration for approval workflow (currently 5s demo delay)
- Grafana V2 dashboard (rule vs LLM breakdown, cost tracking, trust metrics visualization)
- Enhanced Observability
- Grafana dashboards for trust metrics (override rates, outcome breakdown)
- Real-time trend analysis visualization
- Cost tracking (LLM API calls vs rule matches)
- Evaluation Framework
- Golden dataset collection (50-100 incidents)
- Replay testing CLI (
python -m agent.replay --replay-all) - Accuracy reports (action accuracy, root cause accuracy)
- Trust metric calibration (use override data to tune confidence thresholds)
- Advanced Rules
- Expand from 8 to 15+ patterns (connection leak, circuit breaker open, etc.)
- Adaptive confidence scoring (learn from verification outcomes + override data)
- Context-aware rules (time-of-day, deployment correlation)
- More Go-specific patterns (channel deadlock, GC pressure)
- C++ Sidecar (Experimental)
- eBPF-based monitoring (sub-100μs overhead)
- gRPC inference bridge (vLLM/Ollama)
- 87% memory reduction (24MB vs 180MB Python)
- Open-source core (MIT license)
- Managed cloud offering
- Enterprise features (SSO, RBAC, audit logs, SOC 2)
| Metric | V1 (Python + LLM) | V2 (Hybrid) | Improvement |
|---|---|---|---|
| Average MTTR | 2,500ms | 350ms (60% rules) | 86% faster |
| Cost/1000 incidents | $6.00 | $2.40 | 60% savings |
| Works offline | ❌ No (Claude required) | ✅ Yes (rules layer) | Reliability |
| Safety layers | 1 | 6 | 6x protection |
| False positive rate | ~15% | ~8% (policy blocks) | 47% reduction |
| Auto-rollback | ❌ Manual | ✅ Automatic | Zero-touch recovery |
Contributions welcome! See CONTRIBUTING.md for guidelines.
Focus areas for contributors:
- Add new rule patterns (see
services/agent/rules.py) - Improve policy matrix (see
services/agent/policy.py) - Add integration tests for hybrid RCA flow
- Expand Grafana V2 dashboard
MIT — see LICENSE for details.
- Google SRE Workbook — Multi-Window, Multi-Burn-Rate Alerts
- Google SRE Book — Blameless Post-Mortem Culture
- Anthropic Claude API Documentation
- Prometheus Best Practices
Built by Nizami Jussupov
For questions, issues, or feature requests: GitHub Issues