APIs for facts, the agent for analysis: AWS DevOps Agent in production
This article shows one possible way to ground AWS DevOps Agent investigations in current, verified facts. Code gets control-plane facts, such as alarm state, resource version and recent changes, and the agent analyses telemetry. This can help reduce findings that are not supported by facts. The article gives a Lambda function that puts the facts in the investigation, a Skill and an agent instruction that make the agent cite them, a fact check, a watchdog and an on-call checklist.
APIs for facts, the agent for analysis: AWS DevOps Agent in production
By Kiran Khambete and Krish Balaraman · AWS Enterprise Support
Content level: Intermediate · ~12 minute read · Feature snapshot: November 2026
⚠️ About this article. The bank, the team and the incidents are composites from several financial-services customers. No real customer, case or figure appears. The authors checked the documentation and the pricing on 2 November 2026.
The code is sample code for non-production use. It shows only the main logic. The authors did not run it against a live Agent Space. Test each step in a non-production Agent Space. Get approval from your security and legal teams before deployment.
About this series
- Turning AWS Support Cases into Operational Intelligence with the Coding Agents You Already Have
- Evaluating AI operations agents against your real support case data
- Are we ready to open the lines? A custom SRE agent for the contact-center risks your pipeline can't catch
- It passed every check and still broke production: shift-left release readiness, from incident to setup
- APIs for facts, the agent for analysis: AWS DevOps Agent in production (this article)
Summary and practices
- The rule. Use code to get control-plane facts: configuration, state and change history. Use AWS DevOps Agent to analyse logs, metrics and traces, and to find the root cause.
- The design. A Lambda function puts the facts for an alarm in the webhook
descriptionfield. The agent does not get thedataobject. A Skill and an agent instruction tell the agent to cite the facts. The design applies only to investigations that start from a generic webhook.- Failed runs. Add an EventBridge rule for failed and timed-out investigations and mitigations. Custom agents and evaluations send no events. Use the watchdog for evaluations, and the History tab for custom agents.
- Write access. Classify each MCP tool that changes data as
MUTATIVE. An unclassified tool isREAD_ONLYand runs without approval.- Context and feedback. Record expected behaviour, for example a maintenance window, as a memory. Mark each incorrect root cause as incorrect. Keep the investigation journal, so that you can see each tool call.
- Evaluation. Before production use, run 10 to 20 alarms with the facts and without the facts. Compare the results. Do this again after service updates.
The problem
In Part 2, a payments team used AWS DevOps Agent on its top incident category. By quarter two, the agent was in the production paging path.
One morning, the on-call engineer read an investigation summary. The summary said that the failing service had no alarm. The alarm existed, and the engineer had created it. The team did not keep the tool calls of that run, so the team could not find the cause. The causes in this article are the likely causes that the documentation gives.
Whatever the cause, the agent should not have to find again what the alarm already knows. Thus, the team designed a function that puts the facts in the incident description. With the facts, the agent would start from the alarm, the related alarms and the recent write events. The engineer could then compare each fact with the API output in the same message.
The fact sheet does not correct a scope problem. If the alarm is outside the Agent Space, the fact sheet hides the problem. Thus, also check the scope (see "Behaviours to design for").
The default policy of the agent already permits these API calls. The design uses code for three reasons:
- The same answer each time. Two runs of one incident start from the same facts.
- A fast review. An engineer can compare a fact with the summary in seconds.
- Less agent time. The agent costs $0.0083 per agent-second (pricing). An 8-minute investigation costs $3.98. A Lambda lookup uses no agent time. The team did not measure the difference in cost.
The AWS AI Service Card supports this design. The agent gives no confidence score, so a person must judge each finding. The Service Card also tells customers to evaluate the agent on their own workloads before critical production use.
Which tool for which task
| Task | Tool |
|---|---|
| Get a control-plane fact: alarm state, cluster version, recent changes | Code, before the run |
| Analyse logs, metrics and traces, and find the root cause | The agent |
| Check the facts again after the run | Code, after the run |
| Find a run that did not finish | An EventBridge rule and a watchdog |
Behaviours to design for
| Behaviour | Likely cause | Fix |
|---|---|---|
| A chat answer about EKS versions was out of date. | The answer came from model knowledge, not from a DescribeClusterVersions call. | Use the DescribeClusterVersions API or the EKS version page for reference data. |
| A finding changed during a run. Two runs of one incident gave different results. | The summary changes when the agent gets more evidence (autonomous incident response). | Fork the investigation to test a different cause. |
| A summary showed planned maintenance as a fault. | The agent has no record that the behaviour is expected, unless you add one. | Add a memory that describes the expected behaviour (managing assets). |
| A summary said that an alarm did not exist. | The alarm is outside the Agent Space or the role policy, which the agent cannot see (Service Card). Or the incident did not identify the alarm. | Put the alarm in the fact sheet (F1, F3). Check the scope. |
The design
| Tier | Components |
|---|---|
| Minimum | Step 1 (fact-sheet function) and Step 2 (Skill and agent instruction) |
| Recommended | Add the failed-run rule and the watchdog |
| Optional | Add Step 3 (fact check after the run) |
Alarm ─▶ SNS ─▶ [1] fact-sheet function ──▶ DynamoDB (incident ID → sheet)
│ webhook: incident ID + description = sheet (ALARM state only)
▼
DevOps Agent investigation ── [2] Skill + instruction: cite fact IDs
│ Investigation Completed event
▼
EventBridge ─▶ [3] fact-check function ─▶ SNS ─▶ [4] on-call engineer
Permissions. Give each function only these actions:
- Fact-sheet function: the five read actions in Step 1,
secretsmanager:GetSecretValueon the webhook secret, anddynamodb:PutItemon its table. SetResource: "*"forcloudwatch:DescribeAlarms, or the call does not return composite alarms. - Fact-check function:
aidevops:GetBacklogTask,aidevops:ListJournalRecords, the same read actions, DynamoDB read and update, andsns:Publish. - Watchdog:
aidevops:ListBacklogTasksandsns:Publish.
The Lambda Python runtime includes a version of the AWS SDK that depends on the runtime and the Region (docs). If it does not include the devops-agent client, package a current boto3 with the function.
Step 1: The fact-sheet function
Create a generic webhook with HMAC authentication on the Capabilities tab of the Agent Space. Keep the URL and the secret in Secrets Manager. The console shows the secret one time only.
Subscribe the function to the SNS topic of the alarm. Let sns.amazonaws.com invoke the function.
CAUTION: If the topic also receives
OKActions, the function receives a message when the alarm recovers. Start an investigation only when the new state isALARM. If you do not, each recovery starts a new investigation.
The function collects five facts with read-only calls:
| ID | Fact | API |
|---|---|---|
| F1 | The alarm: state, start time, metric and threshold | cloudwatch:DescribeAlarms |
| F2 | The last state changes of the alarm | cloudwatch:DescribeAlarmHistory |
| F3 | Other metric alarms with the same dimension values. Alarms on other dimensions are not included, so a sheet with no other alarm does not prove that none exists. | cloudwatch:DescribeAlarms |
| F4 | The configuration of the resource: EKS version and status, or RDS engine version and Multi-AZ | eks:DescribeCluster, rds:DescribeDBInstances |
| F5 | Write events on the resource in the last 60 minutes | cloudtrail:LookupEvents |
The sheet contains no metric values and no log lines. The agent reads them with its own tools.
Do these steps in the function:
- Read the alarm name and the new state from the SNS message.
- If the new state is not
ALARM, stop. - Make the five calls. Set a short timeout on each call.
- If a call fails, write
◇ not collectedon its line. Do not stop the function. - Make the incident ID from the alarm name and the time of the state change.
- Save the sheet in DynamoDB.
- Send the sheet in the
descriptionfield of a signed webhook request.
The webhook removes duplicate requests, so each incident ID must be unique. Save the sheet before the webhook request, so that Step 3 can always find it.
Sign each request with HMAC-SHA256. The webhook page gives the signing method and a complete example. Only the title, description, priority and incident reference go to the agent. HTTP 200 means that the request is queued. It does not mean that the investigation is complete.
The sheet has this fixed format:
FACT SHEET collected 2026-11-02T06:43:10Z by code (read-only API calls)
F1 cloudwatch:DescribeAlarms payments-5xx is ALARM since 2026-11-02T06:42:05Z; Payments/Http5xxCount GreaterThanThreshold 50.0
F2 cloudwatch:DescribeAlarmHistory 2026-11-02T06:42:05Z Alarm updated from OK to ALARM
F3 cloudwatch:DescribeAlarms other alarms on ClusterName=payments-eks: payments-p99-latency (OK)
F4 eks:DescribeCluster payments-eks: version 1.36, status ACTIVE
F5 cloudtrail:LookupEvents payments-eks: 1 write event in 60 min: UpdateNodegroupVersion 06:31:40Z by deploy-role
Know these API limits:
LookupEventsaccepts one lookup attribute for each call. It returns 50 events for each page and accepts two requests each second for each account and Region (API reference).- CloudTrail typically delivers logs about 5 minutes after the API call, as an average and not as a guarantee (how CloudTrail works). The page is about log delivery, so check the delay for
LookupEventsin your own account. F5 can be missing a change from the minutes before the alarm.
Test in a non-production Agent Space first. Set the alarm to ALARM with SetAlarmState, and make sure that the investigation shows the full sheet. Then set the alarm to OK, and make sure that no new investigation starts.
Step 2: The Skill and the agent instruction
The design uses two native features for two jobs:
- A Skill holds the procedure. The agent loads a Skill when the task matches the Skill description.
- An agent instruction holds the rule that must apply each time. The agent gets its instructions at the start of each session.
Save the Skill as use-the-fact-sheet/SKILL.md. Upload the folder as a .zip file. Keep the agent type Generic.
--- name: use-the-fact-sheet description: Use this skill in each incident investigation that has a FACT SHEET in its description, and for questions about the configuration, state, version, count or quota of the AWS environment. It tells the agent to use the facts that code collected, to call a read-only describe or list API for other facts, to analyse metrics, logs and traces with its own tools, and to cite the fact IDs. --- # Use the fact sheet 1. The FACT SHEET is the start state. Code collected each line with the read-only call on that line. When a finding uses a fact, cite its ID, for example "(F3)". 2. For a different configuration or state fact, make a read-only describe or list call first. Then give the result. If the call fails, say so. 3. Analyse metrics, logs and traces with your telemetry tools. The fact sheet does not contain them. 4. If you give a fact without a call, write "(not verified)" after it. 5. If a call gives a value that is different from the fact sheet, give the two values and their times.
Add the instruction. Go to the Agents page, open a managed agent, and open the Agent definition tab. Add the text below to the Global instructions. When you save, the new text replaces the existing global instructions. Thus, add this text after the existing text. The console asks you to confirm the save.
The documentation does not state which managed agent writes the summary. Thus, the design uses the global instructions. The text applies only when an incident description contains a FACT SHEET.
When an incident description contains a FACT SHEET, end each investigation
summary with "Facts used:" and the fact IDs that your conclusions use, for
example "Facts used: F1, F3". If no fact applies, write "Facts used: none".
The Skill and the instruction give guidance. They do not enforce the rule. The Facts used: count in Step 3 shows how often the agent obeys them.
Step 3 (optional): The fact check after the run
This function shows the facts that changed during the run. It also shows if the summary cited its facts. It does not judge the conclusions.
-
Create an EventBridge rule for the
Investigation Completedevent of your Agent Space:{"source": ["aws.aidevops"], "detail-type": ["Investigation Completed"], "detail": {"metadata": {"agent_space_id": ["<your-agent-space-id>"]}}} -
Call
GetBacklogTaskwith thetask_idof the event. Readtask.reference.referenceId. The API reference does not state that this value is the webhookincidentId, so test it. If it is not, put the incident ID in the title also, and use the title. -
Read the saved sheet from DynamoDB with the incident ID.
-
Call
ListJournalRecordswithrecordType=investigation_summary_md. Find the record whoserecordIdis the same assummary_record_id. Make one test call to find the key incontentthat holds the Markdown. If the event has nosummary_record_id, recordNO_SUMMARY. -
Collect the facts again for the saved alarm name. Compare each fact with the saved sheet, and give it a mark from the table below.
-
Read the
Facts used:line. Count the(not verified)markers. -
Send the result to the on-call channel. Send a page only if a fact that the summary used is ⚠ or
late. Remove duplicate events with thesummary_record_id.
| Mark | Description |
|---|---|
| ✓ | The fact did not change. |
| ⚠ | The fact changed. For F5, a write event occurred after the sheet. |
late | A write event occurred before the sheet, but CloudTrail delivered it after the sheet. |
| ◇ | The call failed. The fact was not checked. |
incident payments-5xx-2026-11-02T06:42:05Z
fact sheet 06:43Z checked 06:58Z
✓ F1 payments-5xx is ALARM
✓ F2 no new state change
✓ F3 other alarms on the resource: payments-p99-latency (OK)
✓ F4 payments-eks: version 1.36, status ACTIVE
⚠ F5 new write event: UpdateNodegroupVersion 06:49Z by deploy-role
facts used by the summary: F1, F3, F5 not-verified markers: 1
WARNING: The role of this function can read all journals in the Agent Space. The journals also contain chat messages (IAM permissions). Protect the role and the function logs.
Step 4: The on-call checklist
- Read the fact sheet first, then the summary. If a conclusion is different from the fact sheet, use the fact sheet value. Then examine the conclusion again.
- Examine each conclusion that cites a ⚠ or
latefact. Check each(not verified)fact. - Read the label of each finding. A hypothesis is not a confirmed cause.
- Open the evidence for each root-cause finding.
- To test a different cause, fork the investigation. Do not start a second run.
- If the root cause is incorrect, mark it incorrect and give the actual cause. For a quality assessment, start a Review.
- If the summary shows expected behaviour as a fault, add a memory.
Guardrails and runs that send no events
The team found three behaviours. Each behaviour is a guardrail that operates as the documentation describes.
| Behaviour | Reason |
|---|---|
| The agent did not restart pods. | The agent has no write access to application resources until you enable directed actions. EKS access is read-only (EKS access setup). |
| A scheduled custom agent did not write its report to Amazon S3. | Approval requests show only in chat, and outside chat a call that changes a resource fails (directed actions). The permission guardrail also has no write operations such as s3:PutObject (limiting agent access). |
| The team found no events for custom agents. | Custom agents and evaluations send no EventBridge events (EventBridge integration). |
Keep the write path narrow:
- Classify each MCP tool that changes data as
MUTATIVE. Classify each tool that deletes data asDESTRUCTIVE. The agent never uses aDESTRUCTIVEtool. - Keep custom agents read-only. Make changes in chat with approval, or in a reviewed pull request.
- For regulated environments, start with directed actions off. Let an engineer review each remediation.
Add a rule for failed runs:
InvestigationFailedRule: Type: AWS::Events::Rule Properties: EventPattern: source: ["aws.aidevops"] detail-type: ["Investigation Failed", "Investigation Timed Out", "Mitigation Failed", "Mitigation Timed Out"] detail: { metadata: { agent_space_id: [!Ref AgentSpaceId] } } Targets: - Id: alert Arn: !Ref AlertTopic
Let events.amazonaws.com publish to the topic. If the topic uses KMS, use a customer managed key. Let the key policy give kms:GenerateDataKey* and kms:Decrypt to events.amazonaws.com (SNS encryption keys).
Add a watchdog function that runs each 15 minutes. It uses ListBacklogTasks with sortField=CREATED_AT, order=DESC and a creation-time filter. It reads all pages. Make the creation-time window longer than 90 minutes. If the window is shorter, a stuck task leaves the list before the watchdog sends the alert.
FAILED = {FAILED, TIMED_OUT}
FINISHED = {COMPLETED, CANCELED, SKIPPED, LINKED} + FAILED
for task in ListBacklogTasks(createdAfter = now - window):
if task.status in FAILED and task.type != INVESTIGATION:
alert(task, "FAILED") # the rule above covers investigations
elif task.status not in FINISHED and age(task) > 90 minutes:
alert(task, "STUCK") # includes PENDING_TRIAGE, WAITING and new statuses
NOTE: The Task API spells the status
CANCELED. EventBridge events spell itCANCELLED. Use the correct form for each.
The documented task types do not include custom agents. Thus, use the History tab for custom-agent runs. Send PENDING_CUSTOMER_APPROVAL alerts to the approver. Add a CloudWatch alarm that tells you if the watchdog stops.
Key takeaway
AWS DevOps Agent gives the best results when it starts from complete and current context. Use code to get control-plane facts, before and after the run. Show the facts to the engineer next to the summary. Use the agent to analyse logs, metrics and traces and to find the root cause. Record expected behaviour as memories. Give feedback on each investigation. Add a watchdog for runs that send no events.
References
- AWS AI Service Card: AWS DevOps Agent · Pricing · What's new
- Invoking DevOps Agent through webhook · EventBridge integration · Events detail reference
- Skills · Agent instructions · Managing assets · Directed actions · Autonomous incident response
- AIDevOpsAgentAccessPolicy · IAM permissions · Limiting agent access
- API reference: GetBacklogTask · ListJournalRecords · ListBacklogTasks · CloudTrail LookupEvents
- Samples and patterns: aws/tools-for-devops-agent · Automated network incident response · Best practices for production
- Language
- English
Relevant content
- Accepted Answer
asked 5 days ago
- Accepted Answer
asked 5 months ago
AWS OFFICIALUpdated 3 months ago