Inside an AI SRE investigation: hypotheses, tool calls and the evidence trail

2026-11-29来源 dev.toEnglish
Inside an AI SRE investigation: hypotheses, tool calls and the evidence trail

"The AI looked at your cluster and found the root cause" is a sentence that hides almost everything that matters. Between the alert and the answer there are dozens of decisions: which data to read first, which explanation to chase, when to stop, and how sure to be. Those decisions are where AI investigations succeed or quietly fail, and they are the part a demo never shows.

This article opens the box. It describes how an agentic investigation works, where it goes wrong, and the design choices that separate an answer you can act on from a fluent guess.

The loop every AI SRE runs

Almost every AI SRE product today is built on the same pattern, usually called an agent loop and first described in the ReAct paper: the model reasons about what it knows, chooses a tool to call, reads the result, and repeats until it decides it has an answer. In an incident, the tools are reads: a PromQL query, a LogQL query, kubectl get and describe, a rollout history, a runbook search.

An investigation loop: an alert arrives, the agent states hypotheses, chooses a tool call, reads the evidence, and either confirms or refutes each hypothesis until one survives with enough support

Each turn of the loop is one read. The quality of the answer depends on which reads are chosen and what is done with the ones that disagree.

The loop is powerful because it adapts: a crash loop leads to the previous container's logs, an OOM kill leads to the memory limit, a deploy boundary leads to the rollout history. It is also where three failure modes live.

Three ways an investigation drifts

It anchors on the first plausible story. A model that reads "error rate up after deploy" will happily spend its whole budget confirming that the deploy did it, without ever reading the evidence that would show the node ran out of disk at the same moment. Nothing in a bare agent loop forces it to look for disconfirming evidence.

It wanders. Given twenty tools and no guidance, a model calls the ones it has heard of. A two-person SRE team at STCLab reported to the CNCF that adding exclusion rules to their runbooks ("no Loki, no Tempo, no Istio here; use kubectl and PromQL only") cut wasted tool calls from 16 to 2 per investigation. Same model, same alert.

It reports confidence it has not earned. The model writes "high confidence" because the story is coherent, not because the evidence is strong. Coherence and correctness are different things, and a reader at 03:00 cannot tell them apart. The companion article on confidence is about exactly this.

Three ways to build an AI investigator

The difference between products is mostly in what they add around the loop.

Approach How it works What you can check afterwards Typical failure
Chat over your telemetry You ask questions; the model queries and summarises The chat transcript Answers the question you asked, not the one you should have
Free agent loop The model chooses tools until it decides it is done A narrative, sometimes with the queries Anchoring on the first story; confidence from fluency
Hypothesis-driven investigation Causes are stated up front, each with a prediction; reads confirm or refute them Every hypothesis, the read behind each finding, and why the losers lost Slower to write; needs more structure in the engine

The third approach is closer to how a good engineer works, and to the method in our article on root cause analysis for Kubernetes: enumerate the candidate causes, state what each one predicts, then go and look.

What a hypothesis-driven investigation records

For a crash-looping payments service, a hypothesis-driven investigation starts by writing down the candidates and their predictions before reading anything:

  • If this is an OOM kill, the last termination reason is OOMKilled and the exit code is 137.
  • If a config value is missing, the previous container's last log line names it and the exit code is the application's own.
  • If the deploy caused it, the restarts begin at the rollout boundary.

Each read is then attached to the hypothesis it tests, with the exact query, the cluster, the time and the raw answer. When the termination reason comes back as Error with exit code 1, the OOM hypothesis is not quietly dropped; it is marked refuted, with the record that refuted it. The surviving cause is the one whose predictions held, and the others stay on the page so a reader can disagree with the elimination rather than with a conclusion.

Two engineering details make this trustworthy rather than merely tidy:

  • Untested is not the same as true. A hypothesis the investigation never tested must never be shown as the top cause, however plausible it sounds.
  • Missing data is a result. If a required source could not be read, the honest output is "insufficient evidence", with the missing source named, not a confident guess around the gap.

Budgets: the boring part that decides the bill

An agent loop with no limit is a cost incident waiting to happen. Every serious investigator needs a hard budget per investigation, in tokens and tool calls, enforced in code rather than requested in a prompt, and a defined behaviour when the budget runs out: stop, and report what was found so far. Deterministic work, such as grouping alerts into incidents, should not call a model at all.

This article was written with AI assistance. It first appeared on alertigate.com.

原文:https://www.a8q9.cn/en/article/inside-an-ai-sre-investigation-hypotheses-tool-calls-and-the-evidence-trail-cd0428.html

相关文章