
Triage before you investigate: Strands + AWS DevOps Agent, where the LLM proposes and code decides
A Strands agent on Lambda decides whether AWS DevOps Agent should investigate: the LLM proposes, code decides, Cedar gates. Terraform repo included.
Serverless & Integration Architect · Building enterprise platforms on AWS
Why I built this
Things break in prod. You can add alarms, use AI to investigate with Bedrock, build orchestration around it. There are a lot of ways, and mostly it depends.
What I am trying here is triage. Say a failure starts. Let's add some guardrails in code, define our SLO (service level objective: the share of requests that must succeed, 99% here), and build
something custom around it. That is where Strands comes in.
Let's be honest: here it's mostly basic. With more discussion with the business, we can make it more flexible. DevOps Agent is very capable, and I wanted to investigate its RCA (root cause analysis)
feature.
The gap between "something is off" and "investigate"
AWS DevOps Agent investigates an incident for you, and it bills per agent-second of active work. The usual way to start one is a bare alarm: "error rate above 3.5%".
That tells the agent that something is wrong, not who is affected (which tenant), what it costs the business (checkouts abandoned, orders dropping), or whether it deserves an investigation at all.
So I built the step in between: a small pre-triage sentinel with Strands Agents on AWS Lambda. When a native CloudWatch alarm fires (or every 5 minutes as a sweep), it collects business and
infrastructure signals per tenant and scores them in code. Only when something is anomalous does it ask an LLM for a hypothesis. Code decides whether to escalate, a Cedar policy must agree, and DevOps
Agent gets a pre-built case through
CreateBacklogTask .It is not a faster alarm. Detection belongs to native CloudWatch features. The sentinel's job is the hand-off: business context, a case, a policy gate, a monitor → enforce rollout, dedup and evals.
You will learn how to emit per-tenant business metrics with EMF (CloudWatch Embedded Metric Format) and inject a controllable fault; wake
a Lambda from an alarm state change, with a schedule as a backstop; build a Strands Graph in TypeScript where the decision is a pure function on the edges; gate the side effect with Cedar; and
deploy, verify and clean up with Terraform.
Where this fits, and when not to build it
Before writing an agent, check what AWS already does natively.
- CloudWatch Synthetics canaries covers: Scripted requests on a schedule: an endpoint or user journey is broken even with no users. Does not cover: Real users' outcomes per tenant; no case or hand-off.
- Anomaly detection alarms covers: A learned band per metric; no hand-set threshold. Does not cover: Fresh services: the band takes up to 3 hours to appear and up to two weeks to become accurate.
- Metric math and composite alarms covers: Ratios like errors / invocations (up to 10 metrics per alarm); combining alarms. Does not cover: Context: an alarm is a state, not an explanation.
- Metrics Insights alarms with GROUP BY covers: One alarm query over many series, e.g. per tenant. Does not cover: Same: detection, not triage.
- Application Signals SLOs covers: Any CloudWatch metric or expression as an SLI (service level indicator); burn-rate alarms; multi-window composites. Does not cover: Per-tenant split (one SLO per tenant is the assumption here).
- CloudWatch investigations as an alarm action covers: An alarm starts an AI-assisted investigation directly. Does not cover: Business context and a policy gate before it starts.
- DevOps Agent's own triggers: webhooks , ServiceNow (starts an investigation on ticket creation) and other ticketing integrations, an EventBridge → Lambda →
CreateBacklogTasksample covers: Starting an investigation from your incident tooling. Does not cover: Deciding whether this signal deserves agent-seconds, and what the agent should start from.
Is the 5-minute cron just a synthetic monitor? No. A canary generates traffic and checks the answer. The sentinel generates nothing: it reads the telemetry real requests already produced. The
repo's load generator exists only to create a test fault on a demo app with no users.
Detection should be native. Application Signals SLOs with burn-rate alarms are the better detector: managed, multi-window, and any CloudWatch metric can be the SLI. The scorer in this repo is
a teaching stand-in, about 100 lines you can read and test. What the sentinel adds sits after detection: which tenant, which business metric, a case instead of a state, and a gate before
agent-seconds are spent.
When not to build this: if an alarm → DevOps Agent webhook (or a CloudWatch investigation) already gives your on-call a good starting point; if you have no business metrics beyond what the alarm sees;
or if one team owns one service and "which tenant" never matters.
The idea: LLM proposes, code decides
alarm event or 5-min sweep → collect (code) → score (code) → hypothesise (LLM, only if anomalies) → decide (code) → Cedar → monitor: log | enforce: CreateBacklogTask
Scoring is code, so a quiet run makes no model call. The model only proposes (a cause, a confidence, evidence, a first check) as validated structured output. Code decides. And escalation is a hand-off,
not an action: the sentinel creates an investigation task and never changes anything in the account.
Architecture

- Sample app: API Gateway HTTP API + 3 Lambdas (Node 24, arm64), DynamoDB. Why: Small enough to read in one sitting, real enough to fail.
- Metrics: Hand-rolled EMF lines on stdout, namespace
Sentinel/App, dimensiontenant. Why: NoPutMetricDatacalls; per-tenant signals for free.
- Fault injection: SSM (Systems Manager) parameter
/sentinel/degrade, read per request, 10 s cache. Why: Turn a creeping fault on and off from the CLI.
- Triggers: EventBridge rule on alarm state change (primary); EventBridge Scheduler every 5 min (sweep). Why: Triage starts when a native alarm fires; the sweep catches what no alarm covers.
- Sentinel runtime: Strands Agents TypeScript SDK (
@strands-agents/sdk1.25.0) on Lambda. Why: A short batch job; one toolchain with the app ( ADR 0002 ).
- Model: Amazon Nova Pro, inference profile
us.amazon.nova-pro-v1:0, via Bedrock Converse. Why: Anthropic models failed on my account mid-build ( What broke ); swap withMODEL_ID.
- Escalation target: AWS DevOps Agent,
CreateBacklogTask. Why: The investigation starts with the case, not a bare alarm.
- IaC, Region: Terraform,
hashicorp/aws6.73.0 pinned, one state; us-east-1. Why: Onedestroycleans up ( ADR 0001 ); DevOps Agent availability.
Pointing it at your stack: tenants, function names and window are environment variables (
TENANTS , FUNCTIONS , PREFIX , WINDOW_MIN in handler.ts ). Metric names are constants in
collect.ts ( TENANT_METRICS ) and score.ts ( RATE_METRICS , VOLUME_METRICS , DEFAULT_CONFIG ).Build walkthrough
1. The app: per-tenant business metrics with EMF
The sentinel can only triage what the app tells it. So each handler writes its business outcome as an EMF line: a JSON log line that CloudWatch turns into a
metric, with no
PutMetricData call. app/lib/metrics.ts is hand-rolled: emfLine() builds the _aws envelope (namespace Sentinel/App , the dimension names, one unit per metric) and emit()
writes it to stdout.The checkout handler emits one line per request, with the tenant as the dimension (
app/api/checkout.ts ): const abandon = (): void => emit({ tenant }, [{ name: 'CheckoutAbandon', value: 1 }, { name: 'OrdersPerMinute', value: 0 }]);Every request writes 0 or 1. So the Average of
CheckoutAbandon per minute is the failure fraction for that tenant, and the Sum of OrdersPerMinute is the order count. Login does the same
with LoginFailures .2. A fault you can dial
Every app request reads the flag. A creeping error rate looks like this:
{"mode":"error-creep","rate":0.02,"step":0.005,"every_s":120,"tenant":"acme","started_at":"<iso>"}The error probability starts at 2.0% and rises 0.5 points every 2 minutes: 2.0 → 2.5 → 3.0 → 3.5%, then 4.0% at minute 8. The paging alarm (3 of 3 minutes above 3.5%) cannot fire before about minute 11.
Omit
tenant to hit all tenants; set it to fail one tenant, which dilutes the app-wide rate. A missing or malformed flag means "off": a broken flag must never break the app ( app/lib/degrade.ts ).3. Two triggers: the alarm event first, the schedule as a sweep
In production the sentinel should start when a native alarm says something is off, not up to 5 minutes later.
infra/observability.tf adds a warning alarm that pages nobody: the same app-wide
Lambda error rate as the paging alarm, at ≥ 2% for 2 of 2 minutes.Why 2%? Burn rate is how fast you spend your error budget: the failure rate divided by the budget. A 99% SLO leaves a 1% budget, so 2% is burn rate 2. The paging alarm stays at > 3.5% for 3 of 3.
An EventBridge rule in
infra/agent.tf invokes the sentinel when any of the three alarms enters ALARM ( aws_cloudwatch_event_rule.alarm_to_sentinel ).The
prefix matches all three: sentinel-dev-error-rate (paging), -warning and -anomaly . The EventBridge Scheduler schedule ( rate(5 minutes) ) stays on as a sweep: the alarms only see the
app-wide rate, so one tenant can be well over budget while every threshold stays quiet. Both targets set event-delivery retries to 0, but that is not the whole story: EventBridge invokes the Lambda
asynchronously, and Lambda retries a failed asynchronous run twice by default (see Honest trade-offs).The event only wakes the sentinel. It still reads all its own signals;
triggerOf() in handler.ts puts alarm:<name> or schedule in the log line, not into the decision.4. collect: one GetMetricData call
agent/sentinel/nodes/collect.ts builds one GetMetricData request for the last 30 minutes at 1-minute resolution. Per tenant: LoginFailures and CheckoutAbandon (Average) and OrdersPerMinute
(Sum). Plus an app-wide Lambda error rate as a metric-math expression.The current, still-filling minute is excluded, because its partial datapoint would look like a dip.
5. score: burn rate, in code
agent/sentinel/nodes/score.ts judges failure-rate metrics by burn rate. A 3% failure rate against a 1% budget burns it 3x too fast. DEFAULT_CONFIG sets burn 2 as MEDIUM and 3 as HIGH, a 30% volume drop
as MEDIUM and 60% as HIGH, and two confirming points ( confirmPoints: 2 ).function pointSeverity(metric: string, value: number, baselineMean: number, cfg: ScoreConfig): Severity | null { if (RATE_METRICS.has(metric)) { const burn = value / budget(cfg); return reaches(burn, cfg.burnHigh) ? 'HIGH' : reaches(burn, cfg.burnMedium) ? 'MEDIUM' : null; } if (VOLUME_METRICS.has(metric) && baselineMean > 0) { const drop = (baselineMean - value) / baselineMean; return reaches(drop, cfg.dropHigh) ? 'HIGH' : reaches(drop, cfg.dropMedium) ? 'MEDIUM' : null; } return null;}- The latest two points must both breach, and the weaker of the two sets the severity.
-
OrdersPerMinuteis a volume metric: it is judged by its drop against its own recent mean.
-
reaches()compares with a1e-9tolerance. Without it,1 - 0.99is0.010000000000000009and a 3% rate scores burn2.9999999999999973, just under HIGH. Two unit tests caught this.
The z-score (how many standard deviations a point sits from its recent mean) goes to the model as evidence; the decision does not use it.
6. hypothesise: the only LLM call
agent/sentinel/nodes/hypothesise.ts runs only when score found anomalies. The output contract is a zod schema, passed to a Strands Agent as structuredOutputSchema :export const HypothesisSchema = z.object({ hypothesis: z.string().min(1).describe('One sentence: the most likely cause.'), confidence: z.number().min(0).max(1).describe('0-1. Above 0.7 only if the evidence clearly points to one cause.'), evidence: z.array(z.string()).describe('Specific observations from the data, with numbers.'), suggested_investigation: z.string().describe('What an on-call engineer should check first.'),});A fresh
Agent per call, so no conversation leaks between runs. The output is validated again with HypothesisSchema.safeParse . Any failure (model error, throttling, invalid output) returns null ,
which can only ever produce WATCH.A broken model can make the sentinel quieter, never louder. The system prompt ends with: "Be calibrated: report low confidence when the data is thin or ambiguous. Do not decide whether to page
anyone."
7. decide: a pure function on the Graph edges
agent/sentinel/nodes/decide.ts :export function decide({ anomalies, hypothesis, lastEscalation, now }: DecideInput): DecideResult { if (anomalies.length === 0) return { decision: 'NOISE', reason: 'no anomalies' };
const high = anomalies.filter((a) => atLeast(a.severity, 'HIGH')); if (!hypothesis) return { decision: 'WATCH', reason: `${anomalies.length} anomalies, no hypothesis` }; if (hypothesis.confidence < MIN_CONFIDENCE) { return { decision: 'WATCH', reason: `confidence ${hypothesis.confidence} < ${MIN_CONFIDENCE}` }; } if (high.length === 0) return { decision: 'WATCH', reason: 'no HIGH anomaly' };
const due = high.find((a) => now - (lastEscalation[a.tenant] ?? -Infinity) >= ESCALATION_COOLDOWN_MS); if (!due) return { decision: 'WATCH', reason: 'escalated within the last 15 minutes' }; return { decision: 'ESCALATE', tenant: due.tenant, reason: `${due.metric} ${due.severity} for ${due.tenant}` };}Every branch returns a
reason , which ends up in the task title and the logs. No I/O, so the boundary cases are plain unit tests ( agent/test/score-decide.test.ts ).Note what the LLM can do here. ESCALATE already requires a HIGH anomaly scored by code, so the confidence gate can only turn an ESCALATE into a WATCH. The model can lower recall; it cannot raise a
false positive on its own.
In the deployed Lambda,
lastEscalation is always {} (no state between runs), so the cooldown branch never fires there. The effective cooldown is the clientToken window in escalate .8. The Graph: code owns the path
Strands' docs recommend a Graph "when you want to own the execution path in code".
agent/sentinel/graph.ts uses plain-code nodes (a small CodeNode that extends the SDK's abstract
Node ) and puts decide() in the edge handlers. The Graph itself has no model.Nodes share data through
state.app , the Graph's JSON state store ( run , signals , anomalies , hypothesis , decision , taskId ). Per-run inputs ( now , lastEscalation ) arrive as
invocationState . A run logs its path, for example collect → score → hypothesise → watch .9. escalate: a case for DevOps Agent, with an idempotency token
CreateBacklogTask takes a title, a priority, a task type and a description of up to 10,000 characters. It has no field for a skill or an attachment. So the whole case travels in the description
as markdown: hypothesis, evidence, a table of the code-scored anomalies and the suggested first check ( renderCase() in agent/sentinel/nodes/escalate.ts )./** Same tenant within one cooldown window → same token, so a retry cannot create a second task. */export function clientToken(tenant: string, now: number): string { return `sentinel-${tenant}-${Math.floor(now / ESCALATION_COOLDOWN_MS)}`.slice(0, 64);}The token is the cooldown: the same tenant inside one fixed 15-minute window gets the same token, and there is no escalations table. A failed call is logged and returns
null ; the run still completes.Here is what actually happens on a repeat, observed on 2026-11-22. Every run renders a new description, so DevOps Agent sees the same token with a different payload and rejects it:
Conflicting
idempotency request with same client token but different payload . No second task is created, so dedup holds. But the run logs it as a failure (see Honest trade-offs ).Guardrails
Cedar in front of the side effect
Cedar is an open-source policy language from AWS: you write
permit rules, and anything no rule permits is denied. Before anything is sent, the sentinel asks a Cedar policy whether create_task is
permitted ( agent/sentinel/nodes/guard.ts ).Strands ships Cedar as
CedarAuthorization , an intervention that guards an Agent's tool calls. Here the side effect lives in a code node, not a tool call, so the sentinel calls the same engine,
@cedar-policy/cedar-wasm , directly:// The sentinel may open a DevOps Agent investigation only for a confident, HIGH-severity case.permit ( principal == Sentinel::Agent::"sentinel", action == Sentinel::Action::"create_task", resource)when { context.confidence_pct >= 70 && context.severity == "HIGH" };Cedar has no floating-point type, so confidence travels as an integer percent (
Math.round(confidence * 100) ). No matching permit, an engine error or a policy that does not parse
all mean "do not send", and the run logs guard: escalation blocked: <reason> .This duplicates
decide() on purpose. The policy is a separate, reviewable file that still holds if someone loosens the decider or routes another caller to the escalate path. The tests
( agent/test/guard.test.ts ) pin 0.7 allowed, 0.69 denied, another tenant's HIGH not counting, and a broken policy denying.Monitor, then enforce
ESCALATION_MODE (Terraform variable escalation_mode , read by escalationMode() in handler.ts ) controls the last step. monitor (the default, and the fallback for anything but an Agent Space ID plus the exact string
enforce ) renders the case into the Lambda's log and sends nothing. enforce calls CreateBacklogTask . The Cedar guard wraps the escalator in both modes, so monitor logs show exactly
what enforce would have sent.This replaces an in-graph HITL (human-in-the-loop) step: a Lambda that ends in seconds has nowhere to hold an interrupt, and reviewing logged cases gives the same signal.
Promotion scorecard. Stay in
monitor for at least one week. Promote to enforce only when:-
npm run evalskeeps precision 1.0 and recall ≥ 0.8.
- The shadow logs show zero ESCALATE lines on non-incidents.
- One enforce run against an injected fault on a test stack created one task per tenant-window, and the DevOps Agent investigation started from the case ( Showing the hand-off ).
Review the shadow logs in CloudWatch Logs Insights over
/aws/lambda/sentinel-dev-sentinel :fields @timestamp| filter @message like /"decision":"(WATCH|ESCALATE)"/| parse @message '"trigger":"*"' as trigger| parse @message '"decision":"*"' as decision| parse @message '"reason":"*"' as reason| parse @message '"confidence":*,' as confidence| sort @timestamp descWith the function's log format set to Text, Logs Insights does not discover the JSON fields of a
console.log line, so the query parses them from @message (tested 2026-11-22 on the deployed log group).DevOps Agent: directed actions off
Directed actions are mutating actions, switched by the space preference
elevatedActionsEnabled . The documented API default is false , but my console-created space reported true , so check yours:aws devops-agent get-agent-space --agent-space-id <id>aws devops-agent update-agent-space --agent-space-id <id> --preferences elevatedActionsEnabled=falsepreferences replaces the full set and takes effect immediately. Investigations still work read-only. See Working with directed actions .Deploy → verify → clean up
Everything runs in us-east-1. You need Node.js 22.18+ (it runs the
.ts scripts with built-in type stripping) and npm 11 (tested with 11.20), Terraform 1.17+, the AWS CLI, credentials in your environment, and
Bedrock access to Nova Pro. Costs while deployed are small but not zero. Run every block from the repository root; the README has the same steps with more notes.git clone https://github.com/Wizard-Z/strands-devops-agent-pretriage.git && cd strands-devops-agent-pretriage(cd app && npm ci && npm run typecheck && npm test && npm run e2e) # no AWS: fault flag on, fake AWS(cd agent && npm ci && npm run typecheck && npm test)Agent Space. Terraform's
aws_devopsagent_agent_space (provider 6.73.0) has no arguments for roles, account associations or preferences. So create the space in the DevOps Agent console (it also
creates the DevOpsAgentRole-AgentSpace and DevOpsAgentRole-WebappAdmin roles), turn off directed actions as above, and note its ID.Deploy. In
infra/dev.tfvars set agent_space_id , keep escalation_mode = "monitor" and error_rate_alarm_datapoints = 3 . Then read the plan before you apply it:(cd infra && npm run plan) # typecheck + tests + both bundles, terraform plan -out=dev.tfplan(cd infra && npm run deploy) # terraform apply dev.tfplan (exactly the saved plan)The schedule and the alarm rule are live as soon as they exist;
sentinel_schedule_state = "DISABLED" pauses the sweep.Verify.
aws logs tail /aws/lambda/sentinel-dev-sentinel --since 15m # one JSON line per run, with trigger(cd agent && npm run sentinel) # one local run, monitor modenpm run sentinel calls the same runFromEnv as the Lambda. Look for "trigger":"schedule" lines every 5 minutes, an alarm:sentinel-dev-error-rate-warning line when you inject a fault, and a path
of collect → score → hypothesise → watch or → escalate .Clean up. Run
(cd infra && npm run destroy) in a real terminal (Terraform's prompt must receive your yes ), then delete the Agent Space:aws devops-agent delete-agent-space --agent-space-id <id>Deleting the space removes its association and all investigation data, but not the IAM roles the console created. Delete
DevOpsAgentRole-AgentSpace-* and DevOpsAgentRole-WebappAdmin-* (and any
customer-managed AIDevOps* policies) by hand, after the space is gone ( Deleting an agent space ).The destroy test on 2026-11-22 left 0 resources in state and empty leftover checks (
docs/runs.md ). Left by design: the Sentinel/App custom metrics already published;
CloudWatch metrics cannot be deleted and expire on their own.Showing the hand-off
The claim worth proving is not "the sentinel ran" but "DevOps Agent received the case and started from it". The test runs in AWS as a Step Functions Standard workflow,
sentinel-dev-checks
( infra/statemachines/checks.asl.json ), so every step is visible in the console:- Set
escalation_mode = "enforce"ininfra/dev.tfvarsfor the test window and deploy (set it back tomonitorafterwards).
- In the Step Functions console, open
sentinel-dev-checksand Start execution with input{}. The default is the creep scenario: 2% rising 0.5 points every 2 minutes, 10 requests per second (rps) across three tenants, for 14 iterations (each 50 s of load plus an alarm check, about 12 minutes). Override any field, for example a sudden outage:{"minutes": 4, "flag": {"mode": "error-creep", "rate": 0.1, "step": 0, "every_s": 60}}.
- The workflow runs Preflight (one call per route), sets the fault flag, then each minute drives load with the loadgen Lambda and records the warning, paging and anomaly alarm states. It always turns the flag off, on success or failure.
- Meanwhile the warning alarm wakes the sentinel through the alarm rule, and the 5-minute sweep runs too. Each sentinel run writes one JSON line with
trigger,decision,confidenceandtaskId.

Why Standard? Express workflows stop at 5 minutes, too short for a creep that should take 10+ minutes to reach the paging alarm. (From a laptop instead:
npm run creep-run in agent/ , see the README.)
Then follow the task:aws devops-agent get-backlog-task --agent-space-id <id> --task-id <taskId>You don't need to start anything else. A task created with
CreateBacklogTask starts its investigation automatically: in my runs it was IN_PROGRESS 8 s after creation and COMPLETED
4.3-5.3 minutes later.

Open the Agent Space web app, find the task by its title (
Sentinel: <metric> HIGH for <tenant> ), and check that the investigation's first steps follow the case's suggested first check.
Removing
aidevops:CreateBacklogTask from the role only proves graceful failure (the run completes with taskId: null ). Only a real task, followed to an investigation, proves the hand-off.Results
Deployed
In monitor mode, the first scheduled run returned NOISE in 328 ms, using 130 MB of 512 MB. On 2026-11-22 at 20:13 UTC, a monitor-mode run logged ESCALATE. It was not a true detection: my flat-10% test run
had stopped at 20:07, so the sentinel judged stale datapoints (see Honest trade-offs).
Precision and recall of ESCALATE
Ten scenarios in
agent/evals/scenarios/ (5 real faults, 5 noise, including a tenant-only flat rate, a one-minute blip and a slow drift). Each scenario holds its own signals , which replace collect ;
everything after that is the real Graph. ESCALATE is the positive class; no task is ever sent.(cd agent && npm run evals) # live hypothesis from Bedrock (Nova Pro; costs cents)(cd agent && EVAL_OFFLINE=1 npm run evals) # fixed hypothesis, confidence 0.8: score + decide onlyRun | Precision | Recall | F1 | TP | FP | FN | TN |
|---|---|---|---|---|---|---|---|
Live, Nova Pro (2026-11-22T19:23Z) | 1.0 | 0.8 | 0.889 | 4 | 0 | 1 | 5 |
Offline, fixed confidence 0.8 | 1.0 | 1.0 | 1.0 | 5 | 0 | 0 | 5 |
TP/FP/FN/TN are true/false positives and negatives; F1 combines precision and recall. The one miss is
real-orders-drop-initech : Nova Pro gave confidence 0.6, below the 0.7 gate, so the decision was WATCH.Let's be honest about these numbers. The scenarios are synthetic (
agent/evals/gen-scenarios.ts ) and were written with the thresholds known. They pin current behaviour against regressions; they do not
prove the sentinel generalises to your traffic.Detection timing
Against a loud, flat 10% fault (2026-11-18) a 1-datapoint alarm fired at about 1 minute and the sentinel at about 3.5. Fine: loud faults are an alarm's job. The interesting case is a creep.
I ran two creep runs through the Step Functions workflow (2% rising 0.5 points every 2 minutes, 10 rps, three tenants; details in
docs/runs.md ). Minutes after the fault started (run B is timed
from execution start, about 5 s before the flag was set): | Run A, monitor (21:09) | Run B, enforce (21:29) |
|---|---|---|
First sentinel ESCALATE | 4.7 (sweep) | 11.7 (woken by the paging alarm) |
Warning alarm (≥ 2%, 2 of 2) | 6.1 | 3.5 |
Sentinel woken by the warning alarm | 6.2: ESCALATE (0.75) | 3.6: WATCH (confidence 0.6) |
Paging alarm (> 3.5%, 3 of 3) | did not fire (run ended at 11.9) | 11.6 |
Anomaly alarm | did not fire | did not fire |
DevOps Agent task | none (monitor) | 67221748 , created 11.7, investigation COMPLETED 15.9 |
Run A: the business metric won. The 5-minute sweep decided ESCALATE at 4.7 minutes, 1.4 minutes before the earliest native alarm. It came from per-tenant
CheckoutAbandon , not the Lambda error rate:
checkout fails about twice the flag rate (its inventory call is degraded too), so it reaches HIGH first.Run B: the gate set the timing, not detection. Nova Pro gave confidence 0.6 on every run until the paging alarm, so
decide() held WATCH. ESCALATE came 0.1 minutes after the paging alarm, with
confidence 0.8. No lead time.Two runs are not a benchmark. They do show the trade-off: the confidence gate that makes the sentinel
safe also decides how early it can be.
The model really ran, and only when it should. Bedrock's own CloudWatch metrics (
AWS/Bedrock ,
ModelId=us.amazon.nova-pro-v1:0 ) show 29 Nova Pro calls that day: 14 in the 21:00 hour, one for each
of the 14 sentinel runs that reached hypothesise , and none for quiet runs. On average a call used about
1,550 input and 260 output tokens and took 2.3-2.5 s; the day's Nova usage cost about $0.06.What DevOps Agent found
Enforce mode created four tasks, and DevOps Agent completed all four: initech 21:28:47, acme 21:41:25, globex 21:53:46 and globex 22:03:46. Let's be honest: only the 21:41 task came from a live fault. The
other three were escalated from stale datapoints after a fault had ended (run A's flag was off from about 21:21, run B's from 21:46:41).
I read the summaries of three investigations (initech 21:28, acme 21:41, globex 21:53). Each started automatically from
CreateBacklogTask and took 4.3-5.3 minutes.
- All three found the real cause: the injected test fault, the check workflow and the flag. The evidence came from CloudTrail (
PutParameteron/sentinel/degrade,StartExecutionfrom the console) and the logs. One investigation counted every ERROR asINFRA/DEGRADED: checkout 204, login 179, inventory 261. So, no organic failures.
- All three rejected the sentinel's hypothesis. Nova Pro had proposed a recent deployment. The investigator checked: no code or configuration changes, errors track traffic.
- One investigation critiqued the sentinel itself. It was switched to enforce with no awareness of test runs, so it escalated injected errors as a real incident.
- It named its own gaps. It could not read the flag (no
ssm:GetParameterin the Agent Space), and no code repository was connected, so it gave the fix as requirements rather than a diff.
So the hand-off works: the investigator started from the case, tested its hypothesis, and threw it out with evidence. That is "LLM proposes" working one level up.
And it is a lesson. Three of four tasks were about a fault that was already over, and all four were about a planned test. Check that the latest datapoints are fresh, suppress escalation while a check
execution is active or the flag is set, give the investigator read access to the flag, and connect the repo.
Honest trade-offs
- The LLM gate can only lower recall.
decide()already requires a code-scored HIGH anomaly, so the confidence check can only turn ESCALATE into WATCH. That makes a broken model safe. It also cost the one live eval miss and all of run B's lead time.
- Nova Pro's calibration decides the timing. It sat at 0.6 through a fault that code had already scored HIGH. I switched to Nova Pro because Anthropic models failed on my account, not because I compared calibration; that comparison is still open.
- One task per tenant, even for an app-wide fault. The token is per tenant, so run A in enforce mode would have opened three investigations for one cause.
- Stale datapoints after traffic stops. With no new traffic,
scorejudges the last available points, which are still from the fault. Three of my four enforce-mode tasks (21:28, 21:53, 22:03) came from this, each a real, billed investigation of a fault that had already ended.
- Idempotency conflict, not a no-op. Reusing the
clientTokenwith a new description is rejected as a conflict. Dedup holds, but the run logs a failure. And the 15-minute window is a fixed bucket, so a fault that spans a boundary can create two tasks.
- Lambda's own retries. A failed asynchronous run (a throttled
GetMetricData, a graph that does not complete) is retried twice by Lambda by default, which means extra Nova calls and, across a token window, possibly a second task. The fix is anaws_lambda_function_event_invoke_configwithmaximum_retry_attempts = 0; it is not in the repo yet.
- Scoring judges level, not trend. A slow drift under burn 2 is NOISE by design; a flat tenant-only failure rate at 3% or more scores HIGH and could escalate.
- The schedule adds up to 5 minutes of lag, plus two confirming minutes. That is why the alarm trigger exists. But the event fires once per transition into ALARM: if the warning alarm wakes the sentinel while the fault is still MEDIUM, that run says WATCH, and the next look is the sweep.
- App-wide alarms miss single-tenant faults. The sweep covers that here; per-tenant alarms (Metrics Insights GROUP BY, or one SLO per tenant) are the native fix.
What broke
- The sentinel escalated faults that were already over. 3 of 4 enforce-mode tasks came from stale datapoints after the test traffic stopped. Fix (open): require recent points before scoring, and skip escalation while a planned test runs, which the investigator itself pointed out.
- esbuild bundled the AWS SDK's CommonJS build into ESM output, and every check passed. Fix:
mainFields: ['module', 'main'], and a test that imports each real bundle as ESM.
- Anthropic models started failing with
INVALID_PAYMENT_INSTRUMENT. The sentinel degraded to WATCH as designed. That is why the default model is now Nova Pro.
-
@cedar-policy/cedar-wasm@4.14.1is an empty npm publish that passesnpm auditand signature checks. The repo pins 4.14.0, and the guard test imports the engine.
Cost
us-east-1 list prices (AWS Pricing API, 2026-11-23), free tier not counted:
- Always on, 5-minute cadence, no incidents, no traffic: ≈ $0.21/day, ≈ $6.45/month
- …of which the sentinel itself (GetMetricData $1.38: 288 runs × 16 metrics at $0.01 per 1,000; Lambda arm64 512 MB $0.05; Scheduler ~$0.01): ≈ $1.45/month
- …alarms (20 alarm metrics) + dashboard: $2.00 + $3.00/month
- With steady traffic: add 9 custom metrics: +$2.70 → ≈ $9.15/month
- Per escalation: Nova Pro call (estimate: 1,500 input / 300 output tokens at $0.0008 / $0.0032 per 1K): ≈ $0.002
- Per escalation: DevOps Agent investigation ($30/hour = $0.0083 per agent-second), 4.3-5.3 minutes: ≈ $2.15–2.65
- One 20-minute Step Functions test run, monitor mode (~70 transitions, ~13,400 API requests, Lambda, DynamoDB, logs, Nova calls): ≈ $0.065
- Everything is cents except the investigations, and those are exactly what pre-triage gates.
- The trade-offs have a price. An app-wide fault that opens one task per tenant costs up to ≈ $8 per incident, and a stale-data escalation costs the same as a real one: another reason for the freshness check. The investigation figure is an upper bound (wall clock; idle time is not billed).
- Reproducing this article (deploy, 2 runs, destroy) costs ≈ $0.20 in monitor mode, ≈ $5 with two investigations. DevOps Agent's 2-month trial for new customers includes 20 hours of investigations per month, which covers it.
Future work
That could be my next thing to investigate: make it like a plugin that integrates with your current code and alarms. Other ways too: we could hook it to email or SNS (Amazon Simple Notification
Service).
I think DevOps Agent itself can be the proactive part. Hook it to your git repo connector with capability providers and you have a proper setup; that is just powerful for me.
From the runs, the concrete next steps:
- Know about planned tests. Skip escalation while a check execution is active or the flag is set.
- Check freshness. Score only if the latest points are recent (e.g. within 3 minutes).
- Treat the idempotency conflict as "already escalated", not a failure.
- Give the investigator what it asked for: read access to the flag, and the code repository.
- Replace the scorer with Application Signals SLO burn-rate alarms, one SLO per tenant, and let their state changes be the trigger. The sentinel keeps the context, case, gate and hand-off.
- Stateful cooldown and one task per incident. A table keyed by tenant would give a rolling cooldown, feed
lastEscalationtodecide(), and let an app-wide fault open a single task.
- Deploy markers and a hand-off skill.
deploy_within_minis alwaysnulltoday; asentinel.deployevent would fill it. Asentinel-handoffDevOps Agent skill could explain the case.
- Close the loop. Consume DevOps Agent's investigation-completed events to record outcome and time-to-root-cause per task.
- Claude vs Nova calibration. Run the same evals with a Claude model once access works.
Your turn
Clone the repo, deploy it in monitor mode, and start the
sentinel-dev-checks execution with {} . Then share your results: when your sentinel escalated, which alarm fired first, and what DevOps Agent
found.Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article