Three CloudWatch alarms went red at the same time: an Amazon SQS queue, an AWS Step Functions workflow, and an AWS Lambda function.
The SQS one had no error. No exception, no log line, just a message that had been sitting in the queue for about 671 seconds. A read-only AI agent read that, named the cause (the consumer had stalled) and posted it as a GitHub issue in 2.1 seconds. All three causes took between 2.1 and 6.4 seconds.
Then I tried to fix the Lambda with the agent's own credentials:
AccessDeniedException ... is not authorized to perform: lambda:UpdateFunctionConfiguration
That is the rule this build rests on: the agent finds, a human fixes. It has ReadOnlyAccess plus one Bedrock permission, and nothing else.
It looked like the model was diagnosing outages. When I read my own code again, I found that for two of the three incidents it was repeating an answer I had written for it. That part is below too.
This is the build log: Amazon Nova Pro in a Kiro Crew job, with Python doing the evidence gathering.
simplynadaf
/
incident-investigator
Read-only AI SRE: correlates a CloudWatch alarm into one cited root cause. Amazon Nova Pro phrases it, Python gathers the evidence, nothing gets changed. A Kiro Crew agent.
🔍 Incident Investigator: a read-only AI SRE
Three different production services break at once. A read-only AI agent investigates each one, traces it from the CloudWatch alarm to the metric, to the log or the config, to the change that caused it, and names a single cited root cause plus the fix to run. It never remediates on its own. A human approves each fix, and the alarms recover.
Most AI for incidents makes you faster at correlating signals, not at isolating the cause. This one commits to a single root cause with a confidence level, and tells you what it could not verify.
🏗️ Architecture
The flow is the same for every incident: break → alarm → investigate (read-only) → approve → fix → recover. The agent only ever reads. A human draws the line in production.
🤔 What it does
An alarm tells you something is wrong, not…
Why three services
My first version broke one Lambda and found one timeout. It worked and proved little. A tool that only understands Lambda errors is a Lambda-error parser.
A bad night on call does not hand you one clean error. It hands you a queue that stopped draining, a workflow that started failing after a deploy, and a function that got slower, sometimes with no error log at all. So I rebuilt it around three services that fail in three different ways.
Read-only, and you can check
The agent runs as an IAM user with the ReadOnlyAccess managed policy plus one inline policy, bedrock:InvokeModel on amazon.nova-pro-v1:0, so it can phrase what it found. Try to change something:
$ aws lambda update-function-configuration --function-name demo-ii-checkout-api \
--timeout 10 --profile ii-readonly
An error occurred (AccessDeniedException) when calling the UpdateFunctionConfiguration
operation: User: arn:aws:iam::<account-id>:user/demo-ii-readonly is not authorized to
perform: lambda:UpdateFunctionConfiguration ... because no identity-based policy allows
the lambda:UpdateFunctionConfiguration action
I ran that again before writing this post. An LLM should not rewrite production config on its own, and here it has no permission to.
How it works
harness/investigate.py reads the alarm's namespace and picks an evidence gatherer for that service:
def gather(alarm):
ns = describe_alarm(alarm)["Namespace"]
if ns == "AWS/SQS": return gather_sqs(alarm) # queue age + depth
if ns == "AWS/States": return gather_stepfunctions(alarm) # failed runs + error
return gather_lambda(alarm) # errors + log + config
Python collects facts with read-only calls (Describe, Get, List, FilterLogEvents, CloudTrail LookupEvents), and adds a one-line signal that I wrote for each failure type. Keep that line in mind. Then Nova Pro, at temperature 0.2, writes three short sections from only that evidence: cause, confidence, fix. A guard then drops any line that contains a number of two or more digits that is not in the evidence. The script, not Nova, opens the GitHub issue.
The guard is narrow. It catches invented numbers, not invented words. Keep that in mind when you read the next section.
Three incidents, three signals
| Service | What I broke | What the agent read | Time to RCA |
|---|---|---|---|
| Step Functions | deployed a failing workflow definition |
ExecutionsFailed = 172, error PaymentServiceUnavailable: downstream payment call failed
|
3.1 s |
| SQS | left messages with no consumer | oldest message ~671 s old, 20 visible | 2.1 s |
| Lambda | cut the timeout from 10 s to 1 s |
Errors = 303, timeout log line, Timeout=1, CloudTrail UpdateFunctionConfiguration
|
6.4 s |
The alarms were: ExecutionsFailed above 0, oldest message age above 60 s, and Errors above 0.
SQS is the interesting one. Nothing throws. The only evidence is that the oldest message keeps aging, so a log-only tool sees nothing.
Step Functions has no application log either. The agent read the failure count and the failed execution's error:
Lambda had the most evidence, so it got the sharpest answer. This is the issue it posted:
ROOT CAUSE: The Lambda function "demo-ii-checkout-api" is timing out due to its configured timeout setting of 1 second, which is insufficient for the function to complete its execution.
CONFIDENCE: High, because the error log explicitly states "Lambda invocation ended with Status: timeout (hit the configured time limit)" and the signal indicates "invocations hit the time limit."
FIX (do not run, read-only): Increase the timeout setting for the Lambda function "demo-ii-checkout-api" to allow it sufficient time to complete its execution.
Each run also opened a GitHub issue with the evidence timeline. The issues are public: Step Functions, SQS, Lambda.
A human applies each fix
The agent proposes and a person acts. In the demo, I ran one fix command per incident: restore the good Step Functions definition, purge the queue, restore the Lambda timeout. Each alarm went back to OK.
Two things about those fixes. The agent's own fix text was not always specific. For SQS it said "investigate and resolve the issue causing the consumer to stall." Draining the queue was my step, and it is a destructive one: purge-queue deletes every message. Fine for a demo queue, not something to run blind on a real payments queue.
It was right, partly because I told it
Before Nova Pro sees anything, each Python gatherer adds that one-line signal to the evidence. Here are the two I wrote for SQS and Step Functions, straight from harness/investigate.py:
# SQS: always ends the same way
"... and nothing is consuming them (messages sent but not deleted), so the consumer has stalled"
# Step Functions: always ends the same way
"... which points to the workflow definition itself, not the input, so a recent definition deploy is the likely cause"
Both are fixed text. They appear whenever that gatherer runs, whatever the queue or the workflow is doing. So for two of the three incidents, Nova reported a cause my code had already stated. It was right because those are exactly the two things I broke. The Step Functions run had no CloudTrail change line at all, so the "recent deploy" came from my sentence, not from evidence.
Lambda is different. Its signal depends on what the logs show: a timeout line produces "invocations hit the time limit (points to the timeout setting)", an out-of-memory line produces a memory signal, and so on. That answer also had Timeout=1 from the config and the CloudTrail UpdateFunctionConfiguration event behind it.
So the honest result is this. Python rules did most of the diagnosis, and Nova turned the evidence into a readable cause, confidence and fix. The rules are the part you can test, which is why I built it this way. But on a real incident, the SQS rule would blame a stalled consumer for any SQS alarm, whatever the actual cause. The fix is to make every signal depend on evidence, the way the Lambda one does.
Where it is weak
- Two of the three signals are hard-coded (see the section above). Until they depend on evidence, the SQS and Step Functions answers are only as good as my guess about what broke.
- It is three incidents, one recorded take. This is a demo of a pattern, not a benchmark. I have no hit rate to quote.
- The incidents are small and clean on purpose, so you can reproduce them. A novel outage still needs a human.
- The guard only checks numbers. It does not catch a wrong service name or a wrong verb.
- I measured wall-clock only (2.1 to 6.4 seconds per RCA). I make no MTTR claim, and I did not measure the bill. The services ran about 20 to 30 minutes per take, and the whole stack is small: one queue, one function, one state machine, three alarms.
Run it yourself
git clone https://github.com/simplynadaf/incident-investigator ~/incident-investigator
cd ~/incident-investigator
python3.11 -m venv .venv && .venv/bin/pip install boto3
bash infra/setup_3services.sh # SQS + Step Functions + Lambda + 3 alarms
bash infra/setup_readonly.sh # read-only identity, Bedrock invoke, proves a write is denied
bash infra/incidents3.sh break fulfillment
bash infra/incidents3.sh break payments
bash infra/incidents3.sh break checkout
AWS_PROFILE=ii-readonly python3 harness/investigate.py --alarm demo-ii-fulfillment-failures --post
AWS_PROFILE=ii-readonly python3 harness/investigate.py --alarm demo-ii-payments-backlog --post
AWS_PROFILE=ii-readonly python3 harness/investigate.py --alarm demo-ii-checkout-errors --post
bash infra/incidents3.sh fix fulfillment # a human approves each fix
bash infra/incidents3.sh fix payments
bash infra/incidents3.sh fix checkout
bash infra/teardown_3services.sh # clean up
You need gh logged in, AWS credentials, and Bedrock access to amazon.nova-pro-v1:0 in us-east-1. As a Kiro Crew job, the message is the config: {"alarm": "demo-ii-checkout-errors", "post": true}. The SQS alarm takes a few minutes to go red, so give it time before you investigate.
Your turn
Would you let an AI agent post a root cause to your on-call channel before a human asks it to look? I will reply to every comment.
Drafted with AI help. Every output, number and timing above comes from my own run logs and AWS responses. The agent finds, a human fixes.
Follow me for more on AWS architecture, DevOps, and AI Infrastructure:
Portfolio | LinkedIn | Dev.to | YouTube | Email | AWS Builder Center | X





Top comments (7)
Read-only covers what the agent can change, not what it reads.
FilterLogEventsreturns whatever a Lambda logged, request text included, and that text sits in the model's context beside yoursignalline.I run a CI triage agent that posts unasked, and each run plants a note in the Cypress failure it reads. The note moved ministral-3-3b in 163 of 174 triages, over 58 runs from
42501583888to46767469631. The deny side held: 277run_shellcalls, 277 refused. So the one write it keeps, the summary, passes a notifier that breaks links and mentions first.Your GitHub issue is that write. What happens to a URL the model copies from a log into the issue body?
A useful next test might be to keep the alarm type the same but vary the underlying cause. For example, give the SQS investigator an old-message alarm once with a stalled consumer and once with a healthy consumer facing an upstream burst. If both produce “consumer stalled”, the problem is in the evidence-to-signal rule before the model sees it. I’d also include an insufficient-evidence case and check that the issue says “unknown” rather than naming a cause. Have you tried cases that deliberately contradict the fixed signal?
The honesty about the hard-coded signals is what makes this post work. Most write-ups would have stopped at "3 root causes in seconds". On your question: yes, I'd let it post to the on-call channel, but only if every claim in the message points at a raw evidence line a tired human can check in ten seconds. The numbers-only guard is the seam I'd worry about. A wrong function name or a wrong verb sails straight through it, and at 3am nobody re-reads carefully. Checking that every identifier in the answer appears verbatim in the evidence would catch most of that. Does the GitHub issue include the raw evidence, or only the phrased summary?
Finding your own fixed
signalline behind two of the three answers is the most honest part. Most posts would stop at "2.1 seconds"."The agent finds, a human fixes" is close to an AI hub I built for my self-hosted apps. When its assistant wants to do something destructive, like replace all text in a document, it waits for the person to press Accept. Every action stays in a history, the rejected ones too, marked "not run".
Does your GitHub issue get updated with the fix the human really ran, like the purge, so the finding and the fix sit in one place?
The SQS one is the case that sold me — a message sitting 671 seconds with no error at all, and a log-only tool would have seen literally nothing. Queue age as the signal is the kind of boring metric that turns out to be the whole incident. One thing I'm curious about: what happens on a false positive, when the alarm fires but there's no real cause — does it still open an issue, or is there a 'nothing found' path? With a 2-second RCA the temptation would be to let it file everything, and then the issue tracker becomes the new alert fatigue.
Two of the three answers were already written in the gatherer before Nova ever saw them. The Lambda one earned its cause from the logs, so signals that depend on evidence are the whole difference.
The 671 second old SQS message with no error made me trust queue age more than log lines in my own alerts.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.