From M1 to M7: Building AgentOps with Controlled Ablations, Evidence Ledgers, and Live Model Measurements
How we built and measured AgentOps across milestones M1 to M7—from rule and single-shot baselines to a bounded investigation loop, a 79/87 live DeepSeek failure postmortem, 54-run memory ablations, and LangGraph checkpoint recovery.
From Diagnostic Standards to Controlled Engineering (M1–M7)
In Before Building AgentOps: What Makes a Diagnosis Good Enough? and AgentOps at M4, I set out five requirements before writing the agent loop: separate symptoms from root causes, trace every claim back to a verifiable evidence_key, make every tool call narrow down competing hypotheses, distinguish mitigation/verification/remediation, and allow honest UNKNOWN conclusions when evidence is insufficient.
When implementation started, the main engineering temptation was to wire up LangGraph, a vector store, and a complex multi-step prompt all at once. Doing so makes it impossible to answer basic engineering questions:
- How much of the accuracy comes from the multi-step loop versus simple deterministic threshold rules?
- Does episodic/semantic memory genuinely improve multi-hop diagnosis, or does it contaminate new incidents with stale or misleading past conclusions?
- Does migrating a hand-written loop to LangGraph introduce regressions, and how many duplicate tool executions does step-level checkpoint recovery actually save?
In AgentOps, we progressed strictly through M1 $\rightarrow$ M2 $\rightarrow$ M3 $\rightarrow$ M4 $\rightarrow$ M5 $\rightarrow$ M6 $\rightarrow$ M7, introducing one variable per milestone and measuring it against frozen scenario manifests, deterministic cassette replays, and live deepseek-flash (k=3) runs.
1. Engineering & Verification Summary (M0–M7)
All metrics below are reproduced from committed artifacts in evals/baselines/ and immutable live measurements in evals/measurements/. Offline deterministic harness baselines (offline-harness) and live deepseek-flash API measurements are reported in separate tables and never mixed.
| Dimension | Quantitative Metric | Verification / Artifact |
|---|---|---|
| Completed Milestones | 8 / 10 (M0–M7) | M0 Skeleton, M1 Simulator & Rule Baseline, M2 Async API/SSE/Postgres, M3 Single-Shot LLM, M4 Investigation Loop, M5 CI Gates/Nightly/OTel, M6 Episodic & Semantic Memory, M7 LangGraph/Checkpoints/HITL |
| Automated Test Suite | 123 passed (0 failures) | pytest (SQLite unit/integration + real PostgreSQL 16 + Alembic 0001_m2 -> 0002_m6 -> 0003_m7 restart acceptance) |
| Versioned Eval Scenarios | 35 scenarios (29 frozen-v1 + 6 m6-v1) | SHA-256 locked in frozen-manifest.json (9 holdouts strictly isolated) and m6-manifest.json |
| Cassette Replay Gate | 29 / 29 scenarios (0 drift) | evals/cassettes/m4-frozen.json verified on every PR via python -m app.eval check |
| Evidence Citation Safety | 0.0000 accepted illegal citation rate | Enforced across all offline baselines (M3, M4, M6, M7) and all 165 live deepseek-flash runs |
2. Step-by-Step Development Workflow (M1–M7)
M1: Scenario Simulator, Read-Only ToolPort, and Rule Baseline (Top-1 = 0.6500)
- Hexagonal
ToolPort: 6 read-only tools (query_metrics,search_logs,get_service_status,get_recent_changes,get_dependency_health,query_db_health) with automatic secret/email/IP redaction (<ip-1>) and<untrusted_data>wrapping. - 29 Frozen Scenarios (
frozen-v1, 9 Holdouts): Includes single-service faults, red-herring conflicts (cpu-with-disk-herring,db-pool-with-cpu-herring), multi-hop downstream faults (multihop-checkout-payments-pool,multihop-checkout-pricing-dns), 20-line truncated log drill-downs (drilldown-truncated-dns), and healthy/unavailable-telemetry (NOT_A_FAULT/UNKNOWN) cases. The 9holdout: truescenarios are never inspected when designing rules or prompts. - Result:
diagnose_with_rules()achievesTop-1 = 0.6500,Top-3 = 0.8000, showing where static priority rules fail (red herrings and cross-service drill-downs).
M2: Async Run Executor, SSE Timeline Streaming, and PostgreSQL Persistence
POST /v1/incidents/{id}/runsreturns202 AcceptedwithIdempotency-Keyreplay (202active /200terminal) and409 Conflicton concurrent active runs or archived incidents.GET /v1/runs/{id}/eventsstreamsRunEventrows over SSE withLast-Event-IDresumption; client disconnects do not cancel the background investigation.fail_runs_after_restart()transitions leftoverPENDING/RUNNINGrows toFAILED(restart)on startup, verified against a real PostgreSQL 16 + Uvicorn subprocess restart test.
M3: Single-Shot Code-Swept LLM Baseline (Top-1 = 0.8500)
- Removed all root-cause/herring spoilers from
incident.titleandincident.descriptionacross all 29 scenarios (Issue#30). - Sweeps all 6 tools across every service in
scenario.world.servicesupfront in code, passes the evidence ledger toLLMPortin a single turn, and validates every citedevidence_key(with at most 1 retry on illegal citations). - Result: Offline
Top-1rises from0.6500to0.8500(+0.2000), but averages12.90tool calls per run (up to33) and still failsdrilldown-truncated-dnswhere the default time window truncates the decisive DNS log line.
M4: Bounded Investigation Loop, ReadOnlyVerifier, and Cassette Replay
- 5-Stage Loop (
investigate()):- Triage (Code): Resolves service and default window
[detected_at - 15m, detected_at + 5m]. - Hypothesize & Investigate (Model,
<= 8tool calls): UpdatesHypothesisBoard(PROPOSED/TESTING/LEADING/REJECTED), caches duplicate tool calls without charging budget, and narrows time windows or pivots across services. ReadOnlyVerifier(0tool calls): Constructed without aToolPortreference; verifies citation existence, non-empty supporting evidence, cross-tool corroboration, and absence of unaddressed contradictions.- Graceful Partial Reports: Emits schema-valid
TIMED_OUT/BUDGET_EXCEEDEDpartial reports when limits are hit.
- Triage (Code): Resolves service and default window
- Result: Offline harness achieves
Top-1 = 1.0000while cutting average tool calls from12.90to6.17(-52.2%).
M5: First Live deepseek-flash Measurement — From a 79/87 Failure to 87/87 Completion
- Initial Live Failure (
2026-10-29-deepseek-initial.json, Run40804677634): On 29 scenarios ×k=3(87runs/version), M3 completed84/87(Top-1 = 0.8333), but M4 failed79/87runs (9.2%completion,Top-1 = 0.0000). - Root Cause & Contract Repair (
2026-10-30-deepseek-repaired.json, Run40988173433): Diagnostic reproduction (cpu-saturation-checkout,k=3) showed that M4’s prompt omitted the 6 tool input schemas andDiagnosisReportJSON schema (extra="forbid"), whichInvestigativeFakeLLMhad masked. Injecting the public tool catalog and report contract schemas lifted M4 completion from8/87 (9.2%)to87/87 (100.0%), with0.0000accepted illegal citations, 48.1% fewer tool calls than M3 (6.69vs.12.90), and+20.0percentage points higher severity accuracy (0.8333vs.0.6333).
M6: Evidence-Checked Episodic & Semantic Memory + 54-Run Live 3-Way Ablation
Reporting scope: 54 runs = 6 scenarios × 3 repeats × 3 modes. Top-1, evidence, memory, and tool metrics use only the first repeat (n=6 per mode); only agreement uses all repeats. Semantic memory adds no Top-1 gain; live layer gating enables episodic only.
- 5-Table Schema (
0002_m6):hypotheses,hypothesis_evidence,feedback,memory_items, andmemory_recalls, with write-timeredact_text, similarity deduplication (>= 0.85), and hybrid0.65 * vector_cosine + 0.35 * Okapi BM25ranking weighted by time decay, trust level (CONFIRMED/CANDIDATE/QUARANTINED), andservice_versionstaleness. - Citation-Only Feedback (
POST /v1/runs/{id}/feedback):verdict="correct"promotes only the run’s producedCANDIDATEmemory and recalled memories withcited=true; recalled-but-uncited memories are never promoted. - Live
deepseek-flash3-Way Ablation (2026-11-04-deepseek-m6-ablation.json, Run41819885445, 54 runs onm6-v1):no_memory(Top-1 = 0.5000) $\rightarrow$episodic(Top-1 = 1.0000,+0.5000) $\rightarrow$episodic_plus_semantic(Top-1 = 1.0000,evidence_recall = 0.7222,evidence_precision = 0.7778,avg_tool_calls = 5.50).- Explicit contamination refusal is
0.0(0/4first-repeat cases) for each memory-enabled mode; no-memory is N/A. Correct predictions do not establish explicit refusal.
M7: LangGraph StateGraph Migration, Checkpoint Recovery Experiment, and HITL Approvals
- Explicit
StateGraph(app/agent/langgraph_investigator.py):triage -> recall -> investigate_step <-> tool_dispatch -> verify -> finalize, preservingTop-1 = 1.0000(top1_delta = 0.0,changed_cases = [],verifier_tool_calls = 0) across all 29frozen-v1scenarios. - Checkpoint Recovery vs. M2 Restart-Fail (
0003_m7,run_checkpoints): Defaultcheckpoint_policy="fail"preserves M2’sRUNNING -> FAILED(restart)behavior; opt-incheckpoint_policy="resume"enablesPOST /v1/runs/{id}/resume(with row-level locking and conditional status transition) to resume from the latest saved step with0.00re-executed tool calls. - Human-in-the-Loop Approvals (
action_approvals):GET /v1/runs/{id}/approvalsandPOST /v1/runs/{id}/approverecord operator decisions and appendRECOMMENDATION_APPROVED/RECOMMENDATION_REJECTEDevents to the run’s SSE timeline.
3. Quantitative Results Tables
Table 1: Offline Deterministic Harness Baselines (frozen-v1, 29 Scenarios, 9 Holdouts)
| Milestone & Mode | Agent Identifier | FAULT Top-1 | FAULT Top-3 | Evidence Recall | Evidence Precision | Verdict Accuracy (FAULT / NOT_A_FAULT / UNKNOWN) | Avg Tool Calls (Max) | Accepted Illegal Citations |
|---|---|---|---|---|---|---|---|---|
| M1 Rule Baseline | rule-baseline | 0.6500 | 0.8000 | 0.8000 | 0.6627 | 0.90 / 0.80 / 1.00 | 6.00 (6) | 0.0000 |
| M3 Single-Shot LLM | single-shot-llm | 0.8500 (+0.2000) | 0.9500 (+0.1500) | 0.9500 | 0.8167 | 0.95 / 1.00 / 1.00 | 12.90 (33) | 0.0000 |
| M4 Hand-Written Loop | investigation-loop | 1.0000 (+0.1500) | 1.0000 (+0.0500) | 1.0000 | 1.0000 | 1.00 / 1.00 / 1.00 | 6.17 (8, -52.2%) | 0.0000 |
M7 LangGraph StateGraph | langgraph-investigator | 1.0000 (0.0000 vs M4) | 1.0000 (0.0000 vs M4) | 1.0000 | 1.0000 | 1.00 / 1.00 / 1.00 | 6.17 (8, Verifier 0) | 0.0000 |
Table 2: Live deepseek-flash 29-Scenario No-Memory Measurement (frozen-v1, k=3 = 87 Runs/Version)
Live Version (deepseek-flash, k=3) | Completed Runs | FAULT Top-1 | FAULT Top-3 | Evidence Recall | Evidence Precision | FAULT Severity Accuracy | agreement@3 | Avg Tool Calls (Max) | First-Output / Accepted Illegal Citations |
|---|---|---|---|---|---|---|---|---|---|
M4 Pre-Contract Fix (2026-10-29) | 8 / 87 (9.2%) | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0920 | 6.50 (8) | N/A / 0.0000 |
M3 Single-Shot (2026-10-30) | 86 / 87 (98.9%) | 0.8500 | 0.9333 | 0.9333 | 0.7292 | 0.6333 | 0.9770 | 12.90 (33) | 0.0000 / 0.0000 |
M4 No-Memory Agent (2026-10-30 Repaired) | 87 / 87 (100.0%) | 0.7333 | 0.7667 | 0.7472 | 0.6750 | 0.8333 (+0.2000) | 0.9425 | 6.69 (8, -48.1%) | 0.0230 / 0.0000 |
Table 3: M6 3-Way Memory Ablation (m6-v1, 6 Scenarios, Offline Baseline + Live deepseek-flash k=3 = 54 Runs)
Ablation Mode (m6-v1 Suite) | Offline Harness Top-1 (k=1) | Live deepseek-flash Top-1 (k=3, 18 runs/mode) | Live agreement@3 | Live Evidence Recall | Live Evidence Precision | Live memory_recall@k | Live memory_citation_precision | Contamination / Staleness Refusal (12 runs) | Live Avg Tool Calls |
|---|---|---|---|---|---|---|---|---|---|
no_memory | 0.3333 (2/6) | 0.5000 (3/6) | 0.9444 | 0.3889 | 0.3611 | 0.0000 | 1.0000 | N/A | 6.17 |
episodic (+Episodic) | 0.6667 (+0.3334) | 1.0000 (6/6, +0.5000) | 1.0000 | 0.6667 (+0.2778) | 0.6500 (+0.2889) | 1.0000 | 1.0000 | 0 / 4 (0.0000) | 5.67 |
episodic_plus_semantic (+Episodic +Semantic) | 1.0000 (+0.6667) | 1.0000 (6/6, +0.5000) | 1.0000 | 0.7222 (+0.3333) | 0.7778 (+0.4167) | 1.0000 | 1.0000 | 0 / 4 (0.0000) | 5.50 |
Table 4: M7 Checkpoint Recovery vs. M2 Restart-Fail Controlled Experiment (5 Scenarios)
| Recovery Policy | Interrupted Run Status After Restart | Resumed Run Completion Rate | Resumed FAULT Top-1 | Avg Re-Executed Tool Calls | Avg Total Tool Executions to Complete |
|---|---|---|---|---|---|
Control: M2 Restart-Fail (checkpoint_policy='fail', default) | FAILED (restart) (/resume blocked with 409) | 0.0000 (requires manual full rerun) | N/A (manual rerun: 1.0000) | 1.00 | 8.00 |
Treatment: M7 Checkpoint Recovery (checkpoint_policy='resume', opt-in) | FAILED (restart) $\rightarrow$ RUNNING $\rightarrow$ COMPLETED | 1.0000 (5 / 5) | 1.0000 (5 / 5) | 0.00 (-100%) | 7.00 (-12.5%) |