Case study

SREBot
An AI first responder for incidents.

When production breaks, the first half hour usually goes to finding out what is actually wrong. SREBot does that part. It reads the alert, investigates with the tools an on-call engineer would use, and writes a report with its evidence. When a rollback or a restart would help, it proposes exactly one, and changes nothing until a person approves it.

A personal project. It runs on a local Kubernetes cluster next to a small demo shop that a chaos lab can break in twelve ways, and everything on this page was recorded from that system. The source code is private for now.

lab incidents diagnosed correctly by Claude Haiku 5.5
12/12
median time from alert to report
33 s
average model cost per incident
$0.0033
changes applied without an approval
0

Watch an incident, from alert to recovery

Each replay is a real incident from the chaos lab: the alert, every query SREBot ran and what it saw, its report and, where one applies, the fix and the recovery. Time runs faster than it did; the clock shows the real time since the alert.

A new payments release adds a slow fraud check to every charge, and every order slows down. SREBot ties the slowdown to the release and proposes a rollback; after the approval it checks that orders are fast again. Five alerts fired, and all of them ended up in this one incident.

  1. Alert
  2. Investigating
  3. Root cause
  4. Fix
  5. Recovered
  1. 0:00

    Alert fired

    storefront is using up its "Orders complete within half a second" error budget too fast

  2. 0:20

    Investigation started on claude-opus-5-5

  3. 0:23

    I'm starting the investigation now.

  4. 0:23

    query_metrics_rangePrometheus

    histogram_quantile(0.95, sum by (service, le) (rate(http_request_duration_seconds_bucket{namespace="demo"}[2m])))

    minutes: 90

    What it saw · 12 ms
    {"window": "2026-11-01T00:47:45Z to 2026-11-01T02:17:45Z", "total_series": 3, "series": [{"labels": {"service": "checkout"}, "min": 0.08976, "max": 1.788, "first": 0.09305, "last": 1.344, "points": [{"minutes_ago": 82.5, "value": 0.0938}, {"minutes_ago": 75.0, "value": 0.09382}, {"minutes_ago": 67.5, "value": 0.09404}, {"minutes_ago": 60.0, "value": 0.0939}, {"minutes_ago": 52.5, "value": 0.09415}, {"minutes_ago": 45.0, "value": 0.0942}, {"minutes_ago": 37.5, "value": 0.09387}, {"minutes_ago": 30.0, "value": 0.09357}, {"minutes_ago": 22.5, "value": 0.09397}, {"minutes_ago": 15.0, "value": 0.09465}, {"minutes_ago": 7.5, "value": 0.09363}, {"minutes_ago": -0.0, "value": 1.344}]}, {"labels": {"…
  5. 0:23

    query_metrics_rangePrometheus

    sum by (service, target, status) (rate(http_client_requests_total[2m]))

    minutes: 90

    What it saw · 5 ms
    {"window": "2026-11-01T00:47:45Z to 2026-11-01T02:17:45Z", "total_series": 9, "series": [{"labels": {"service": "checkout", "status": "200", "target": "payments"}, "min": 2.562, "max": 5.558, "first": 4.981, "last": 4.905, "points": [{"minutes_ago": 82.5, "value": 4.981}, {"minutes_ago": 75.0, "value": 4.972}, {"minutes_ago": 67.5, "value": 4.972}, {"minutes_ago": 60.0, "value": 4.972}, {"minutes_ago": 52.5, "value": 4.972}, {"minutes_ago": 45.0, "value": 4.972}, {"minutes_ago": 37.5, "value": 4.791}, {"minutes_ago": 30.0, "value": 4.934}, {"minutes_ago": 22.5, "value": 4.981}, {"minutes_ago": 15.0, "value": 5.558}, {"minutes_ago": 7.5, "value": 4.905}, {"minutes_ago": 0.0, "value": 4.905}]}…
  6. 0:23

    get_eventsKubernetes

    namespace: demo · minutes: 120

    What it saw · 16 ms
    {"namespace": "demo", "events": [{"object": "Pod/payments-57c8769d78-dmb7m", "type": "Normal", "reason": "Killing", "message": "Stopping container payments", "count": 1, "last_seen": "2026-11-01T02:16:38Z"}, {"object": "ReplicaSet/payments-57c8769d78", "type": "Normal", "reason": "SuccessfulDelete", "message": "Deleted pod: payments-57c8769d78-dmb7m", "count": 1, "last_seen": "2026-11-01T02:16:38Z"}, {"object": "Deployment/payments", "type": "Normal", "reason": "ScalingReplicaSet", "message": "Scaled down replica set payments-57c8769d78 from 1 to 0", "count": 1, "last_seen": "2026-11-01T02:16:38Z"}, {"object": "Pod/payments-6cd96d74c9-5js7g", "type": "Normal", "reason": "Started", "message":…
  7. 0:27

    The payments rollout went out at 02:16:32, and latency spiked right after. I'll check the payments rollout history and the payments logs to see whether the two are connected.

  8. 0:27

    get_rollout_historyKubernetes

    namespace: demo · deployment: payments

    What it saw · 10 ms
    {"deployment": "payments", "desired_replicas": 1, "ready_replicas": 1, "conditions": [{"type": "Available", "status": "True", "reason": "MinimumReplicasAvailable", "message": "Deployment has minimum availability.", "lastUpdateTime": "2026-10-31T20:52:18Z"}, {"type": "Progressing", "status": "True", "reason": "NewReplicaSetAvailable", "message": "ReplicaSet \"payments-6cd96d74c9\" has successfully progressed.", "lastUpdateTime": "2026-11-01T02:16:38Z"}], "revisions": [{"revision": 35, "current": true, "created_at": "2026-11-01T02:16:32Z", "change_cause": "release v2-slow", "image": "demo-app:dev", "env": {"SERVICE_NAME": "payments", "RELEASE": "v2-slow"}, "ready_replicas": 1}, {"revision": 34…
  9. 0:27

    query_metrics_rangePrometheus

    histogram_quantile(0.95, sum by (service, le) (rate(http_request_duration_seconds_bucket{namespace="demo"}[1m])))

    minutes: 10

    What it saw · 4 ms
    {"window": "2026-11-01T02:07:49Z to 2026-11-01T02:17:49Z", "total_series": 3, "series": [{"labels": {"service": "checkout"}, "min": 0.092, "max": 1.854, "first": 0.09385, "last": 1.854, "points": [{"minutes_ago": 8.5, "value": 0.09423}, {"minutes_ago": 7.8, "value": 0.09291}, {"minutes_ago": 7.0, "value": 0.09328}, {"minutes_ago": 6.3, "value": 0.09371}, {"minutes_ago": 5.5, "value": 0.09325}, {"minutes_ago": 4.8, "value": 0.09317}, {"minutes_ago": 4.0, "value": 0.0951}, {"minutes_ago": 3.3, "value": 0.09312}, {"minutes_ago": 2.5, "value": 0.09263}, {"minutes_ago": 1.8, "value": 0.09378}, {"minutes_ago": 1.0, "value": 0.09347}, {"minutes_ago": 0.3, "value": 1.85}]}, {"labels": {"service": "p…
  10. 0:27

    search_logsLoki

    {namespace="demo", service="payments"}

    minutes: 5

    What it saw · 14 ms
    {"window": "2026-11-01T02:12:49Z to 2026-11-01T02:17:49Z", "total_lines": 2, "truncated": false, "groups": [{"service": "payments", "pod": "payments-6cd96d74c9-5js7g", "message": "fraud check v2 enabled for all charges", "first_seen": "2026-11-01T02:16:33Z", "last_seen": "2026-11-01T02:16:33Z", "example_fields": {"level": "info", "service": "payments", "release": "v2-slow"}, "count": 1}, {"service": "payments", "pod": "payments-6cd96d74c9-5js7g", "message": "service started", "first_seen": "2026-11-01T02:16:33Z", "last_seen": "2026-11-01T02:16:33Z", "example_fields": {"level": "info", "service": "payments", "release": "v2-slow", "port": 8080}, "count": 1}]}
  11. 0:40

    I'm comparing the latency at 02:02–02:16 under revision 34, which was healthy, so I'll roll back to 34. This has happened repeatedly since v2-slow was deployed three times. The 30-minute burn rate of 6.8x looks high given the spike only started a minute ago, so the earlier 01:51 v2-slow incident is probably still inside that window, and that's fine.

  12. 0:40

    Report ready

    payments · Bad deployment

  13. 0:40

    Fix proposed, waiting for approval

    Roll back payments to revision 34 (release v1) to undo the slow v2-slow release that has been running since 02:16:32. (medium risk)

  14. 0:47

    Approved by eval runner

  15. 0:47

    Fix applied

  16. 1:20

    Same cause: grouped into this incident

    storefront is using up its "Orders complete within half a second" error budget too fast

  17. 2:11

    Same cause: grouped into this incident

    High p99 latency on checkout

  18. 2:11

    Same cause: grouped into this incident

    High p99 latency on storefront

  19. 2:26

    Same cause: grouped into this incident

    High p99 latency on payments

  20. 2:57

    Recovery verified after 130 s

  21. 2:59

    Closed by the eval runner before the next scenario

  22. 3:30

    Postmortem draft written

The report

Payments was rolled out to revision 35 (release v2-slow, which turns on 'fraud check v2') at 02:16:32. Within about a minute, p95 latency on payments rose from about 0.09 s to about 1.5 s, and checkout and storefront followed to about 1.85 to 1.9 s, which breaks the 0.5 s orders-fast SLO. Rolling payments back to revision 34 (v1), which was healthy from 02:02 to 02:16, should restore latency. This is the third time v2-slow has been deployed in about an hour.

Root cause

paymentsBad deploymenthigh confidence

Payments release v2-slow (revision 35, deployed 02:16:32) turns on 'fraud check v2 enabled for all charges'. That raised payments p95 latency about 16x, from about 0.09 s to about 1.5 s. Checkout waits on payments and storefront waits on checkout, so the delay reaches every order.

Evidence

  • kubernetespayments rollout history: revision 35 'release v2-slow' (RELEASE=v2-slow) was created 2026-11-01T02:16:32Z and the old ReplicaSet payments-57c8769d78 was scaled down at 02:16:38. The previous revision 34 runs RELEASE=v1.
  • metricsp95 latency (1m rate) was steady at about 0.09 s for payments, checkout and storefront until 02:16. In the next minute it reached payments 1.48 to 1.62 s, checkout 1.85 s and storefront 1.90 s, the same minute as the rollout.
  • logsThe new payments pod payments-6cd96d74c9-5js7g, release v2-slow, logged 'fraud check v2 enabled for all charges' at 02:16:33.
  • metricsDependency calls look healthy apart from latency: checkout→payments stays at about 4.9 req/s with status 200, checkout→redis at about 5 req/s ok with no errors, and storefront→checkout 502s are close to 0 (0.0095/s). This is a slowdown, not an error spike.
  • kubernetesRevision history shows v2-slow deployed at 01:27 (rev 29), 01:51 (rev 32) and 02:16 (rev 35), and SREBot rolled it back to v1 each time (rev 30, 33, 34). That explains why the 30m burn rate is 6.8x.

Fix SREBot can apply

Roll back payments to revision 34 (release v1) to undo the slow v2-slow release that has been running since 02:16:32. verified

Postmortem draft: Slow payments release made storefront orders miss the half-second target

At 02:16:32 UTC payments was rolled out to revision 35 (release v2-slow). That release turns on 'fraud check v2' for all charges. Payments p95 latency rose about 16x, and checkout and storefront slowed with it, breaking the 0.5 s orders-fast SLO. SREBot traced the slowdown to the payments rollout and proposed a rollback. The rollback to revision 34 (release v1) was approved and applied at 02:18:09, and recovery was confirmed at 02:20:19. This was the third time v2-slow had gone out in about an hour: 01:27, 01:51 and 02:16. Each earlier time it was rolled back, and nothing stopped it from being deployed again.

  • P1 Find what keeps deploying payments release v2-slow (it went out at 01:27, 01:51 and 02:16) and stop it.
  • P1 Block release v2-slow from deploying to payments, or pin payments to v1, until fraud check v2's latency is fixed.
  • P2 Put fraud check v2 behind a feature flag. Fix its performance, or move it off the synchronous charge path, before enabling it for all charges.
  • P2 Add a canary or progressive rollout for payments that halts and reverts automatically if p95 latency regresses against the previous revision.
  • P2 Alert when a deployment rolls out a release that was rolled back within the last 24 hours.
  • P2 When a release is rolled back for an incident, automatically open a follow-up ticket to block or fix that release, so a rollback is never the last step.
  • P3 Review the HighLatency alert windows and thresholds: they fired after the rollback here. Tune them to fire alongside the burn-rate alert, or remove them if the burn-rate alert covers the case.

The console

The team works in SREBot's own console: service health and SLOs, incidents with their reports and timelines, approvals, and the chaos lab.

SREBot console overview during the cart database outage, with both SLOs burning and two services in trouble
The overview during the cart database outage: both SLOs burning faster than their alert thresholds, and the services that need attention.
An incident in the SREBot console with its postmortem draft and the investigation step by step
The slow release after the approved rollback: the postmortem draft, and every step of the investigation as it happened.

How it works

  1. 01

    Detect

    Prometheus and Alertmanager send alerts, including SLO burn-rate alerts, and a watcher polls GitHub Actions for failed runs. SREBot opens one incident per problem: repeats are deduplicated, and alerts with the same cause are grouped.

  2. 02

    Investigate

    An agent loop on the Claude API picks its own next step: PromQL, LogQL, Kubernetes rollouts and events, or a run's logs, commits and files. Every tool is read-only, results are masked before the model sees them, and the loop has a budget.

  3. 03

    Report

    The answer is structured, not prose: where the failure starts, what kind of failure it is, how sure SREBot is, the evidence, and the recommended actions with their risk.

  4. 04

    Fix

    If a rollback, a scale-up or a restart would restore service, the report proposes one. Code, not the model, rates the risk, and nothing runs until a person approves. Then SREBot watches the metrics to confirm recovery.

  5. 05

    Learn

    When the incident resolves, SREBot drafts a blameless postmortem from its own timeline: impact, detection, root cause, what went well and the action items.

Reads

  • Prometheus
  • Loki
  • Kubernetes API
  • GitHub API
  • Runbooks

Only an approved fix crosses this line, through a separate, opt-in role.

Writes

  • rollback
  • scale
  • restart

Built so it cannot make things worse

An agent that can touch production has to be boring in the right places. These are the rules SREBot runs by.

  • Read-only by default

    The investigator's tools can only read. Apart from the demo's chaos lab, the one write path is an approved fix, and it needs a separate, opt-in Kubernetes Role that can patch and scale Deployments in the watched namespaces and nothing else.

  • The model proposes, code decides

    A fix is one of three typed actions: roll back, scale up or restart a Deployment. A policy in code rates the risk and blocks what it does not allow, whatever the model asked for.

  • A person approves

    Every fix waits for an approval in the console. Who decided, when, and what happened next are recorded on the incident's timeline.

  • Verified, not assumed

    After a change, SREBot checks that the service recovered. A fix that did not help is reported as unverified instead of quietly closing the incident.

  • Masked before the model

    Keys, tokens, email addresses, card numbers and public IP addresses are masked in tool results before they reach the model, and the timeline records how many values were masked.

  • Untrusted text stays data

    Logs and commit messages can contain text that looks like instructions. The prompts treat tool results as data, GitHub access is limited to the watched repositories, and the agent cannot run commands.

  • Bounded cost

    Each investigation has a cap on tool calls and on cost, and SREBot stops starting new ones when the day's model budget is spent. Tokens, cost and latency are Prometheus metrics with their own dashboard.

Measured, not assumed

Every lab scenario has an expected answer: where the failure starts, what kind of failure it is, which fix to propose, and facts the report has to state. A runner starts each scenario on the live system, waits for the report and grades it. Where a fix was proposed, it approves the fix through the same API as the console and waits for SREBot to verify recovery. Grading is field and text checks, so no model grades another model.

ScenarioClaude Haiku 5.5Claude Opus 5.5
Production
Payment provider outagecorrectreport in 40 s · $0.0044correctreport in 53 s · $0.1491
A few payments failcorrectreport in 70 s · $0.0059correctreport in 53 s · $0.1565
Slow payments releasecorrectreport in 40 s · recovered in 141 s · $0.0042correctreport in 40 s · recovered in 130 s · $0.1184
Memory leak in paymentscorrectreport in 47 s · recovered in 20 s · $0.0055correctreport in 42 s · recovered in 20 s · $0.1202
Cart database outagecorrectreport in 37 s · recovered in 125 s · $0.0041correctreport in 46 s · recovered in 135 s · $0.1299
Delivery
Deploy with a missing imagecorrectreport in 32 s · recovered in 15 s · $0.0026not run
Deploy that needs a missing secretcorrectreport in 33 s · recovered in 15 s · $0.0027not run
Release that never gets readycorrectreport in 33 s · recovered in 15 s · $0.0027not run
CI pipeline
A change breaks a unit testcorrectreport in 31 s · $0.0020not run
A dependency version that does not existcorrectreport in 30 s · $0.0018not run
A publish step without its secretcorrectreport in 30 s · $0.0021not run
A dependency with a critical CVEcorrectreport in 30 s · $0.0021not run
12 of 12 correct · median 33 s to report · $0.04 in total5 of 5 correct · median 46 s to report · $0.67 in total

Claude Haiku 5.5 runs every scenario at a fraction of a cent. Claude Opus 5.5, which recorded the production replays above, ran the five production scenarios and got all five right, at about $0.13 per investigation; the rest were left out to keep model budget for live demos.

The first pipeline run found a real problem: the prompt let a dependency pinned to a version that does not exist pass as a code defect. After rewording the prompt to classify failures by what is broken, the next run got it right. Finding that kind of mistake is what the evals are for.

In these runs and in the replays above, “eval runner” is the runner pressing Approve.

Runs like production

SREBot is deployed the way a team would run it, so the demo also exercises the platform work around it.

  • Infrastructure as code

    Terraform creates the kind cluster, installs Argo CD and points it at the repository. One command builds everything; another tears it down.

  • GitOps

    An Argo CD app-of-apps deploys the rest from Helm charts: the monitoring stack, the demo shop and SREBot itself.

  • Observability and SLOs

    Prometheus, Alertmanager, Loki, Tempo and Grafana. SLOs are Kubernetes resources: an operator written in Go turns each one into recording rules and multiwindow, multi-burn-rate alerts, unit-tested with promtool.

  • Console and MCP

    A React console for incidents, approvals and the chaos lab, and an MCP server, so Claude Code or another agent can read incidents and use SREBot's tools behind a token.

  • Quality gates

    Every pull request runs ruff, mypy, pytest with a 90% coverage gate, the console's checks, helm lint, kubeconform, Terraform validation, promtool tests and a Trivy scan.

Decisions and trade-offs

An agent loop, not one big prompt
Collecting every metric and log into one prompt is cheaper per call, but it guesses up front what matters. Letting the model choose its queries costs a few more calls and finds causes two hops away, such as checkout errors that start in Redis.
Approval before any change
Full autonomy is not trustworthy yet, and an incident is the worst time to find that out. Proposing one typed fix and waiting for a person keeps the speed of the investigation and leaves the judgement with the team.
Deterministic evals
Because the report is structured, grading is field and text checks. Results are reproducible and cheap, and the checks caught a prompt mistake that a model acting as judge could have explained away.
Pipelines are incidents too
Many production problems start in delivery. A failed GitHub Actions run becomes an incident with its own read-only tools, so CI failures get the same timeline, report and process.
A cheap model for daily work
Development and most eval runs use Claude Haiku 5.5 at under a cent per incident; the recordings here use Claude Opus 5.5. The model is one deployment setting, so the choice is easy to revisit.

What I would build next

  • An independent verifier that tries to disprove the first hypothesis before the report goes out.
  • Memory across incidents, so a repeat failure starts from what was learned the last time.
  • More sources through MCP, such as Datadog, Sentry, PagerDuty, Slack and Jenkins.
  • A pilot on real traffic, measuring time to mitigation before and after.

Stack

  • Python
  • FastAPI
  • Claude API
  • MCP
  • React
  • TypeScript
  • Kubernetes
  • Helm
  • Argo CD
  • Terraform
  • Prometheus
  • Alertmanager
  • Loki
  • Tempo
  • Grafana
  • OpenTelemetry
  • GitHub Actions
  • Trivy