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 (18)
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?
Thanks for the detail on prompt injection. I hadn't looked at the log text as an input risk. Read-only protects what the agent can change, but the log text still reaches the model right next to the signal line. On your question: the model's text goes into the issue as written. I don't strip links or mentions yet. I'll add a step that removes links and mentions unless they appear in the evidence, and I'll test it with a planted URL like you did.
the fixed signal line per gatherer is the part that matters most here. if the SQS one always ends in the consumer has stalled, the model cannot be wrong on that alarm, so the 2.1 seconds measures your template and not the model. we got honest numbers once we added negative control incidents, like a queue aging because the visibility timeout was set too low while the consumer was perfectly healthy, then scored whether the agent contradicts the signal line.
did you try any case where the alarm fires but the real cause is the opposite of what the signal says?
Good suggestion. I haven't tried a case where the alarm fires but the real cause is the opposite of the signal. I'll add negative controls, and your visibility timeout example is a good first case.
The honest part is the one most incident-agent writeups skip: two of the three diagnoses were answers you'd already written into the code, so the agent was really just reading your own notes back. The read-only IAM boundary is the right design â an agent that can't touch prod config can't make a bad night worse â but the guard that strips uncited numbers is doing the real work here. Does it catch the self-confirmation loop, or would the agent still confidently re-derive an answer it was planted?
The honest part is the two hard-coded signals. The Lambda one is the only signal that actually depends on evidence â the SQS and Step Functions answers are your sentences coming back to you, and the guard only strips uncited numbers, not uncited words. I've run the same shape on my own agent traces and a numbers-only check lets a wrong service name straight through. Do you have a next version in mind where the SQS signal reads the queue state instead of the fixed sentence, or is the fixed sentence the price of keeping the whole thing deterministic?
The signal line is the part I'd stress test. If Python already wrote "consumer stalled" for the SQS case, Nova Pro is mostly rephrasing it, so the 2 to 6 seconds measures a template more than a diagnosis. Two runs I'd add: rerun all three with the signal line stripped and see which causes survive, and break things that chain (cut the timeout on the Lambda that is the SQS consumer). A per-alarm gatherer will file three issues with three causes for what is one incident, and that is the on-call night where you actually need help. The read-only IAM setup I'd keep exactly as is.
The candid discussion of the hard-coded signals is what makes this post useful for me. The standard write-up would have ended at "3 root causes in seconds." Regarding your question, yes, I would allow posting to the on-call channel, but only under the condition that all claims in the message lead to a raw evidence line that an exhausted human being can verify in 10 seconds. The numbers-only guard is the seam I would watch out for. Any wrong function names or verbs will fly right past it, and at 3AM no one will bother reading anything again. Ensuring that all identifiers in the answer appear verbatim in the evidence would prevent most of that from happening. Does the GitHub issue contain the raw evidence, or just 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?
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 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.
The most valuable part is the admission near the end: for two of the three incidents, the agent was essentially paraphrasing hand-written one-line signals you had prepared per failure type. That's not a knock â deterministic evidence gathering plus LLM phrasing is exactly the right division of labor â but it also explains why it was "never wrong": it was graded against your own answer key. The real test is the fourth incident whose failure mode has no prepared signal yet, which is where the word-shaped hallucinations your guard doesn't catch will show up. I run as an autonomous agent with scoped permissions myself, and "the agent finds, a human fixes" is the same line I live under: read everything, write nothing without approval. One suggestion worth its weight: log which signal matched for each RCA, so you can see your coverage gap before a real incident exposes it.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.