Skip to Content

Event Driven AI Agents with Prometheus Alerts, From Page to Root Cause

Event Driven AI Agents with Prometheus Alerts, From Page to Root Cause
Event Driven AI Agents with Prometheus Alerts, From Page to Root Cause

Alertmanager can wake a human or it can wake an agent. Here is how to wire Prometheus alerts into an AI agent that investigates before you do.

Highlights

  • What an event driven AI agent is, and how it differs from the chat assistant you paste logs into after the fact.
  • Why alert fatigue is the forcing function, with typical teams fielding thousands of alerts a week while only about 3 percent need immediate action.
  • The architecture end to end: Prometheus fires, Alertmanager routes, a webhook wakes the agent, and a report lands in Slack with evidence attached.
  • The read only toolset an agent needs for real root cause analysis: PromQL queries, pod logs, Kubernetes events, and recent deployment history.
  • How to write Prometheus alert rules an agent can act on, with annotations that carry context instead of just a name.
  • A maturity ladder from enrichment to guarded auto remediation, so you adopt this without handing production to a language model.
  • The tools already doing this in 2026, including HolmesGPT and kagent from the CNCF ecosystem, plus when to build your own webhook receiver instead.

Research from incident.io puts a typical enterprise team's alert volume above 2,000 per week, and only about 3 percent of those alerts require immediate action. The other 97 percent still interrupt a human, and most of them die in the same ten investigation steps: check the pod, query Prometheus, pull the logs, look at what deployed. A CNCF case study published in April 2026 put a number on that ritual, with a two person SRE team at STCLab measuring 15 to 20 minutes of manual correlation per alert before they wired an event driven AI agent to their Prometheus alerts to run that first pass. Multiply that ritual by every page in your queue, and you have found where your on call hours actually go.

That first pass is now automatable, and the trigger is infrastructure you already run. Prometheus evaluates the rules, Alertmanager routes the event, and instead of a webhook posting a bare notification to Slack, it wakes an agent that investigates and posts the findings. This guide covers the whole shape: what event driven AI agents with Prometheus alerts actually are, the architecture and code to wire one up, the guardrails that make it safe, and the CNCF tools that already do it.

What an event driven AI agent actually is

An event driven AI agent is a language model with investigation tools that is triggered by a system event, such as a Prometheus alert delivered through an Alertmanager webhook, rather than by a human typing a question. When the alert fires, the agent autonomously queries metrics, logs, and cluster state, correlates what it finds, and produces a root cause hypothesis with evidence, all before a person engages.

The distinction from a chat assistant is the trigger and the initiative. A copilot waits for you to notice the problem, gather the context, and paste it in. An event driven agent starts from the alert payload itself, decides which tool to call next based on each result, and works the loop the way an experienced responder would: pod is crashlooping, so check the exit code, so pull the logs, so look at the last deploy. AIOps platforms have correlated and deduplicated events for years, and this is the step beyond correlation, an agent that actually runs the investigation.

Why alert fatigue is the forcing function

On call economics broke quietly, one alert at a time, and the 2026 numbers describe a system past its limit.

The NeuBird State of Production Reliability report found that 77 percent of on call teams field ten or more alerts every day, while 57 percent say under a third of those alerts are actionable. Catchpoint's SRE survey work found nearly 70 percent of SREs saying on call stress has driven burnout and attrition on their teams, with the median share of time spent on operations climbing to 30 percent. None of these figures describe a discipline problem. They describe a volume problem that threshold tuning has not fixed in a decade of trying.

Alert triage is where the volume lands, and it is the least differentiated work an engineer does. The investigation steps are nearly identical for most alerts, the context is scattered across four tools, and the outcome for the majority is "known cause, no action" or "noisy rule." Handing exactly that layer to an agent is the point of the pattern: automated incident response for the first pass, humans for the judgment calls that remain.

The architecture, from alert to answer

The pipeline has four stations, three of which you already operate.

Prometheus evaluates your alert rules and fires when an expression holds for its duration. Alertmanager groups, deduplicates, and routes the alert exactly as it does today, except one receiver is a Prometheus Alertmanager webhook pointed at your agent instead of at a chat channel. The receiver accepts the payload, extracts the alert's labels and annotations, and starts an investigation with a bounded toolset. The agent posts its findings, a root cause hypothesis, the evidence for it, and a suggested next step, into the same Slack thread the alert notification landed in.

Wiring Alertmanager to the agent is a routing change, not a platform migration.

# alertmanager.yml: send critical alerts to the agent as well as to humans.
route:
  receiver: slack-oncall
  group_by: ["alertname", "namespace"]
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 4h
  routes:
    - matchers:
        - severity = "critical"
      receiver: ai-agent
      continue: true          # the page still reaches the on call human

receivers:
  - name: slack-oncall
    slack_configs:
      - channel: "#oncall"
  - name: ai-agent
    webhook_configs:
      - url: "http://agent.sre.svc:8080/alerts"
        send_resolved: true
        max_alerts: 5         # cap the batch so one storm cannot flood the agent

The receiver itself is small. This version accepts the webhook, runs the investigation loop against an OpenAI compatible LLM endpoint, and posts the result, with every tool the model can use defined as a safe, parameterized function.

from fastapi import FastAPI, Request
import subprocess, json

app = FastAPI()

def promql(query: str) -> str:
    """Run a PromQL instant query, read only by nature."""
    out = subprocess.run(
        ["curl", "-sG", "http://prometheus.monitoring.svc:9090/api/v1/query",
         "--data-urlencode", f"query={query}"],
        capture_output=True, text=True, timeout=30)
    return out.stdout[:4000]

def pod_logs(namespace: str, pod: str) -> str:
    """Last 200 log lines. The ServiceAccount behind this is read only."""
    out = subprocess.run(
        ["kubectl", "logs", "--tail=200", "-n", namespace, pod],
        capture_output=True, text=True, timeout=30)
    return (out.stdout or out.stderr)[:4000]

def recent_events(namespace: str) -> str:
    out = subprocess.run(
        ["kubectl", "get", "events", "-n", namespace,
         "--sort-by=.lastTimestamp"],
        capture_output=True, text=True, timeout=30)
    return out.stdout[-4000:]

TOOLS = {"promql": promql, "pod_logs": pod_logs, "recent_events": recent_events}

@app.post("/alerts")
async def receive(req: Request):
    payload = await req.json()
    for alert in payload.get("alerts", []):
        if alert.get("status") != "firing":
            continue
        context = {
            "labels": alert.get("labels", {}),          # alertname, namespace, pod
            "annotations": alert.get("annotations", {}),# description, runbook_url
        }
        report = investigate(context, TOOLS, max_steps=8)   # the agent loop
        post_to_slack(thread_for(alert), report)
    return {"ok": True}

That investigate function is the standard agentic loop: hand the model the alert context and the tool schemas, execute each tool call it makes, feed the result back, and stop at a conclusion or the step budget. Eight steps is enough for genuine root cause analysis on most Kubernetes alerts, and the cap keeps both latency and token cost bounded.

Want to build this against a real cluster?

An agent pipeline only becomes intuitive once you have watched it chase a real crashlooping pod. The Prometheus Certified Associate (PCA) course on KodeKloud covers the alerting and PromQL foundations this whole pattern stands on, and the KodeKloud playgrounds give you a disposable Kubernetes cluster with Prometheus where you can break a deployment on purpose and watch your webhook receiver investigate it.

Give the agent tools, read only first

The toolset defines the blast radius, so start with observation and add nothing else until the reports have earned trust.

A useful investigation set is small: PromQL queries against Prometheus, pod logs and describe output, Kubernetes events, and recent deployment or rollout history, since a large share of production incidents trace back to whatever changed last. Every one of those is a read. Bind the agent to its own ServiceAccount with get, list, and watch only, keep secrets access out of the role entirely, and treat the alert payload's labels and annotations as data rather than instructions, since anything that flows into a prompt deserves that suspicion.

Auto remediation is the obvious next want, and the answer is a gate, not a jump. When the agent's diagnosis implies a fix, restart the deployment, roll back the release, scale the pool, it should propose the action in the Slack thread as a button a human clicks, with the actual execution done by a separate, narrowly scoped identity. SRE automation has always worked this way, runbooks first, supervised execution second, unattended automation only for actions that are proven reversible, and an LLM in the loop does not change that ladder. It just climbs it faster.

Write Prometheus alert rules an agent can act on

The quality of the investigation is capped by the quality of the event, which makes your Prometheus alert rules part of the agent's design.

An agent receiving HighErrorRate with no annotations starts from almost nothing. The same alert carrying a description with the current value, the affected service, and a runbook link starts the investigation three steps ahead, and the runbook is not decoration, since agents like HolmesGPT explicitly ground their reasoning in the runbooks you already wrote.

groups:
  - name: checkout.rules
    rules:
      - alert: CheckoutErrorRateHigh
        expr: |
          sum(rate(http_requests_total{job="checkout", status=~"5.."}[5m]))
            / sum(rate(http_requests_total{job="checkout"}[5m])) > 0.05
        for: 10m
        labels:
          severity: critical
          team: payments
        annotations:
          summary: "Checkout 5xx error rate above 5% for 10 minutes"
          description: "Current error ratio is {{ $value | humanizePercentage }} on the checkout service."
          runbook_url: "https://runbooks.internal/checkout-error-rate"
          dashboard: "https://grafana.internal/d/checkout"

Two routing habits keep the pattern affordable and sane. Group related alerts in Alertmanager so a node failure produces one investigation instead of forty, because with an LLM behind the webhook, deduplication is now also cost control. Route only pages worth investigating, critical severity and the warning rules you actually trust, since pointing an agent at known noisy rules automates the noise instead of fixing it.

The maturity ladder for agentic alerting

Adopt this in rungs, and be honest about which rung you are on before reaching for the next.

LevelWhat happens on an alertRisk carried
0. NotifyThe webhook posts the alert text to Slack. A human does everything.None, and no help either.
1. EnrichThe agent attaches context: current metric values, recent events, last deploy.Near zero, read only lookups.
2. InvestigateThe agent runs the full loop and posts a root cause hypothesis with evidence.Low, still read only, but the report must earn trust before people rely on it.
3. Guarded remediationThe agent proposes a fix as an approval button, executed by a separate scoped identity.Bounded, one reviewed action at a time.
4. Auto remediationProven, reversible fixes for specific alerts run unattended, everything logged.Real, so reserve it for actions with a clean rollback and a track record.

Most teams should live at levels 1 and 2 for a quarter, measuring accuracy against what responders actually concluded, before wiring any button at level 3.

The tools already doing this in 2026

The build or adopt question is genuine here, because the CNCF ecosystem matured fast.

ToolWhat it isWhere it fits
HolmesGPTA CNCF Sandbox SRE agent (accepted October 2025) with an agentic loop over 30+ data sources, and direct holmes investigate alertmanager support.The fastest path to level 2 on Kubernetes plus Prometheus, with an operator mode that watches continuously.
kagentA CNCF agent framework for running Kubernetes AI agent workloads, with Prometheus and Grafana tooling built in.When you want to build custom agents but not the scaffolding around them.
K8sGPTKubernetes diagnostics that scans cluster state and explains what is wrong.Lightweight enrichment without a full investigation loop.
KeepOpen source alert management and workflow automation.The routing and deduplication layer in front of whichever agent you run.
Datadog Bits AI SRE, DynatraceProprietary agents embedded in commercial observability platforms.When your telemetry already lives there and open source governance is not a requirement.
Your own receiverThe webhook and loop from this guide, with your tools and your policies.When investigations must follow internal conventions no general tool knows.

Where to start

  1. Pick the three alerts that page most often and add real annotations to their Prometheus alert rules: description with the live value, runbook link, dashboard link.
  2. Stand up the webhook receiver at level 1, enrichment only, and route one critical alert to it with continue: true so humans still get paged.
  3. Compare the agent's enrichment against what the responder actually needed for two weeks, and tune the toolset from the gaps.
  4. Move to level 2 investigations on Kubernetes alerts, or deploy HolmesGPT with the Alertmanager integration and skip straight there.
  5. Add a step budget, a token budget, and per alert cost logging, so the pattern's economics stay visible.
  6. Only then discuss remediation buttons, one action at a time, each behind its own scoped identity.

Conclusion

Alert fatigue was never really an alerting problem. It is an investigation problem, thousands of events per week each demanding the same manual first pass, and that first pass is precisely the repetitive, tool driven, pattern matching work that agents now do well. The infrastructure to adopt it is the Prometheus and Alertmanager you already run, the integration is one webhook receiver, and the safety story is the same least privilege discipline you apply to every other identity: read only tools, scoped ServiceAccounts, human gates on anything that mutates.

Start with one alert this week. Give it real annotations, route it to an enrichment agent alongside the human page, and measure whether the context it attaches would have saved your responder the first fifteen minutes. That number, multiplied by your weekly alert volume, is the business case, and for most teams it is not a close call.

Ready to Build the Observability Skills This Runs On?

An agent is only as good as the alerts and queries beneath it, and those are learnable skills. The Prometheus Certified Associate (PCA) course on KodeKloud takes you deep into PromQL, alerting rules, and Alertmanager routing, the exact foundations this pattern is built on, and the KodeKloud playgrounds give you disposable clusters where a broken deployment costs nothing. Spin one up and wire your first alert to an agent today.

FAQs

Q1: Will an event driven AI agent replace on call engineers?

No, and the teams running this in production are explicit that it replaces the first fifteen minutes of an incident, not the responder. The agent's job is the mechanical first pass: pull the metrics, read the logs, check what deployed, and assemble a root cause hypothesis with evidence, which is exactly the work a CNCF case study measured at 15 to 20 minutes of manual effort per alert. Judgment stays human, deciding whether the hypothesis is right, whether the fix is safe, whether the incident needs escalation, and whether the alert should exist at all. The realistic outcome is fewer interruptions that go nowhere, faster time to a first credible theory, and on call shifts spent on the minority of alerts that genuinely need a person. Teams that frame it as replacement tend to over trust early reports, while teams that frame it as a first pass measure accuracy for a quarter and earn the trust deliberately.

Q2: What access should the agent have to my cluster?

Read only, on its own identity, until its reports have earned trust, and narrowly scoped forever after. Give the agent a dedicated ServiceAccount with get, list, and watch on the resources it investigates, pods, deployments, events, and logs, and deliberately withhold secrets access, exec, and every mutating verb, since an investigation needs none of them. Keep Prometheus access read only through the query API, and treat the alert payload itself, the labels and annotations flowing into the prompt, as untrusted data rather than instructions. When you eventually add remediation, do not widen the investigator's role. Execute approved actions through a second, separately scoped identity, one action per role, behind a human approval button. This is the same least privilege discipline you already apply to CI systems, applied to an operator that acts at machine speed, and it is what makes the difference between a useful agent and a new attack surface on your cluster.

Q3: How is this different from traditional AIOps?

Traditional AIOps operates on the alert stream itself, correlating, deduplicating, and suppressing events so that fifty symptoms collapse into one incident, and it does that with statistical models over event data. An event driven agent starts where correlation stops: it takes the surviving incident and actually runs the investigation, querying Prometheus, reading logs, checking recent deployments, and reasoning across the results to a root cause hypothesis, the way a human responder would. The two are complementary rather than competing, and the strongest 2026 pipelines chain them, with an AIOps or alert management layer like Keep cutting the volume and an agent like HolmesGPT investigating what remains. If AIOps answers "which of these thousand events is one real problem," the agent answers "what is actually wrong and what should we do about it," which is the question the on call engineer was going to spend twenty minutes on.

Q4: What do I need to know to build this myself?

The prerequisites are observability and Kubernetes fundamentals rather than machine learning. You need working PromQL, since the agent's best tool is the queries you teach it, a solid grasp of Prometheus alert rules and Alertmanager routing, because grouping, severity, and annotations directly shape what the agent receives, and enough Kubernetes RBAC to build the read only ServiceAccount the agent runs under. On the application side, a small webhook service and comfort with an LLM tool calling API cover the receiver, and the loop itself is under a hundred lines. If you want structured preparation, the Prometheus Certified Associate (PCA) course on KodeKloud covers the PromQL, alerting, and Alertmanager depth this pattern depends on, and the Kubernetes learning paths cover the RBAC and workload side, with playgrounds for testing the whole pipeline against a cluster you can afford to break.

Q5: Should I deploy HolmesGPT or build my own agent?

Deploy HolmesGPT first if your stack is Kubernetes plus Prometheus, and build your own when you need behavior it cannot express. HolmesGPT is a CNCF Sandbox project with the integration work already done: holmes investigate alertmanager consumes your live alerts directly, more than thirty observability toolsets ship built in, it grounds its reasoning in runbooks you already wrote, and an operator mode runs investigations continuously and posts findings to Slack. That is months of scaffolding you do not have to write. Building your own receiver makes sense when investigations must follow internal conventions, custom tools over proprietary APIs, organization specific verification steps, strict egress and data handling rules, or when you want the agent embedded inside an existing platform service. The pragmatic path many teams take is HolmesGPT for the general case with a small custom receiver for the two or three alert families where house knowledge matters most.

Q6: How do I keep the LLM cost of investigating every alert under control?

Treat cost as a first class design constraint, because an unbounded agent pointed at a noisy alert stream will cheerfully burn your budget investigating duplicates. Four controls do most of the work. First, route selectively, sending only critical severity and trusted warning rules to the agent, since automating the investigation of known noise just makes the noise expensive. Second, let Alertmanager grouping and max_alerts collapse storms, so a node failure triggers one investigation rather than forty. Third, cap every investigation with a step budget and a token budget, and log the spend per alert so the economics stay visible on a dashboard next to your MTTR. Fourth, use a fast, inexpensive model for level 1 enrichment and reserve the stronger model for full investigations on the alerts that page humans. Teams running this pattern report per investigation costs in the cents to low tens of cents, which compares favorably to fifteen minutes of an engineer's time by a wide margin.

Pramodh Kumar M Pramodh Kumar M

Subscribe to Newsletter

Join me on this exciting journey as we explore the boundless world of web design together.