AWS Builder Center

From a Slack Message to a Root Cause: Building a Production Platform Agent on AWS

Nine design decisions behind a platform-engineering agent that triages, investigates, and fixes real incidents. It runs on Amazon Bedrock AgentCore, the Bedrock model family, and Strands Agents. Here is what worked, what broke, and what I wish someone had told me first.

Staff Engineer @ BHub.ai
Every platform team has that one channel. At BHub, ours fills up all day with the same handful of questions: why a pipeline failed, who has access to an account, why a service can't assume a role, whether a given deploy is safe. Each one pulls a human out of whatever they were doing, and most of them already had the same answer last week.
For a while we answered that with a bot that had a classifier bolted to the front. A message came in, a small model guessed the intent, and the bot replied with a ready-to-paste command for the user to run. It felt clever, and it was usually wrong. The classifier misrouted, and even when it routed correctly, handing someone a raw command is not the same as solving their problem. People quietly stopped trusting it, which is about the worst thing that can happen to an internal tool.
So we deleted it. What replaced it behaves less like autocomplete and more like a junior platform engineer who never gets dragged into a meeting. It reads the pipeline logs, inspects the IAM policy, checks the CloudFormation stack, connects what it finds, and then either fixes the problem or tells you exactly who can. It runs entirely on AWS. Bedrock AgentCore Runtime hosts it, the Bedrock model family does the reasoning, and  Strands Agents  runs the loop in the middle.
The change I care about most is the one that is hard to see in a demo. Humans get pulled into far fewer threads now, and they run far fewer investigations by hand, because the agent closes most cases on its own and shows up to the rest with a root cause already written. More on that shift near the end.
This is the honest version of how it's built: the decisions that mattered, the AWS pieces that made each one cheap, and the one bug that quietly broke every investigation for a couple of days.

The stack, and why each piece is there

The point here is not "we used Strands." A production agent is a system, and almost every hard part of that system already has a managed AWS service sitting behind it. We wired those together and let Strands run the loop.
What the agent needs
What we used
Why it earns its place
A place to run, with state that survives a wait
Bedrock AgentCore Runtime
Managed agent runtime; sessions and interrupts persist without us running servers
The reasoning loop, tools, structured output
Strands Agents (TypeScript SDK)
Model-agnostic loop with tools, interrupts, and sessions as first-class ideas
Reasoning at three price points
Bedrock models: Nova, Claude Haiku, Claude Sonnet
One API, a full ladder from cheap sorting to frontier investigation
Safety before and after the model
Bedrock Guardrails
Screens the incoming message and the outgoing answer, outside the prompt
Grounded answers instead of guesses
Bedrock Knowledge Bases plus a web-search MCP tool
Retrieval over our own runbooks, with live docs as a fallback
Cross-account reads, and knowing who may fix what
STS AssumeRole (the reads) and IAM Identity Center (the human permission-set truth)
Read-only roles for the agent; real group membership decides who acts
Session memory, answer cache, playbooks
Amazon S3 (session store, vector store, skill catalog)
One durable substrate for three kinds of memory
Encryption wherever state lands
AWS KMS (SSE-KMS)
Every session snapshot is encrypted at rest, enforced in the SDK middleware
Every row is a boundary we did not have to draw ourselves. That is the whole reason the work below could stay focused on design instead of plumbing.

1. Don't route. Cascade, and default to investigating

The most important change was a change of shape. A router asks which bucket a message belongs in and then commits to it. A cascade asks a different question at each step: can a cheap, safe check finish this? If not, pass it down. Only the last step is the expensive one.
Every message walks the same ladder, and any rung can resolve it or drop it to the next:
  1. Ignore the agent's own messages and route feedback button clicks.
  1. Run the input guardrail before spending a token.
  1. Check thread state. Resolved or already escalated threads stay silent; a thread waiting on a human reply resumes.
  1. Apply a deterministic noise filter, plain code, no model.
  1. Check the semantic answer cache.
  1. Triage with a cheap model into  noise ,  answerable ,  investigate , or  invalid .
  1. Investigate with the full agent on a frontier model.
The subtlety lives in step 6, and it is the piece I would most want you to copy. Triage returns a  kind  and a confidence. Only  noise ,  answerable , and  invalid  are allowed to end the conversation early, and only when confidence clears a bar. Everything else, and anything the model is unsure about, falls through to a real investigation.
const TRIAGE_CONFIDENCE_THRESHOLD = 0.6

function resolveTriage(result: TriageResult, threshold = TRIAGE_CONFIDENCE_THRESHOLD): TriageResult {
if (result.kind === 'investigate') return result
// A cheap classifier only gets to short-circuit when it is sure.
// Anything under the bar becomes a full investigation.
if (result.confidence < threshold) return { ...result, kind: 'investigate' }
return result
}
The bot we deleted deflected by default; this one investigates by default. The cheap model is no longer the decision-maker, just a filter that has to earn the right to close a thread. That single inversion is why people trust the replacement: when it fails now, it fails by overworking a case instead of brushing you off.

2. Fail open, toward doing the work

This deserves its own line because it is a habit worth building everywhere. When the triage model returns malformed JSON, an unknown  kind , or nothing at all, the parser does not throw and it does not drop the message. It returns one constant.
const ESCALATED: TriageResult = { kind: 'investigate', confidence: 0 }
Most systems fail closed: when they are unsure, they do nothing. An assistant that fails closed goes quiet exactly when someone needs it, and silence reads as broken, so this one fails open toward the thorough thing instead. A parsing bug in the cheap path can never swallow a real incident, and the extra cost of an occasional unnecessary investigation is bounded by the loop caps I describe later. That is a trade I will take every time.

3. Cheap first, frontier last: a ladder of models

Because Bedrock puts the whole family behind one API, the cost of a step and the capability of a step became separate knobs, and we could turn them independently.
  • Triage runs on Claude Haiku. Fast and cheap, good enough to sort.
  • Small yes-or-no calls, like "is this answerable from the knowledge base?", run on Amazon Nova Lite.
  • Investigation, the multi-step reasoning that reads logs and correlates evidence, runs on Claude Sonnet.
  • The model-failure fallback chain starts even lower, on Nova Micro, before it climbs.
The lesson is not "use small models." It is that "which model" belongs at the step level, and a single provider is what turns that from an integration project into a config change. You pay frontier prices for the one step that needs frontier reasoning, and nothing else.

4. The agent learns which model a problem needs

This is the one I am proudest of. Static tiering is fine, but a tier that adapts to real results is better.
Every resolved investigation feeds a small feedback loop keyed by problem category. For each category we track how many times the agent has resolved it and how often a human approved the result. A routing function turns that history into a model tier for the next investigation in the same category.
function modelTierFor(category: string, stats: CategoryStats): ModelTier {
if (stats.resolved < 5) return 'default' // not enough history yet
if (stats.approvalRate >= 0.9) return 'cheap' // mastered, spend less
return 'frontier' // still hard, spend more
}
Watching this behave is oddly satisfying. A brand-new class of problem gets the frontier model, because we don't yet trust a cheap one on it. Once the agent has resolved that category enough times with a high approval rate, it demotes itself to a cheaper model. It has learned the category and stops overpaying for it. Categories that stay hard keep the expensive model. Cost ends up tracking difficulty, and difficulty is measured by what actually happened, not by a guess we made at design time.
None of this needed a training pipeline. It is counters in S3 and one routing function, and the Bedrock ladder does the rest.

5. Verify before you answer

An agent that is confidently wrong is worse than no agent, because someone acts on it. So the investigation's output is not the final word. Every proposed root-cause analysis goes to a separate judge call, a second Sonnet with its own prompt, which checks one thing: is this conclusion actually grounded in the evidence the agent gathered?
If the judge approves and the agent did not flag itself for escalation, the answer ships as confident. If the judge is unsure, the answer still ships, but wearing a caveat that tells the reader it is a lead and not a verdict. We never quietly promote a shaky answer to a confident one, and we never throw away a useful but uncertain one either. The agent that writes the answer never signs off on it; a separate call does.

6. Structured output, with a salvage net

The investigator does not return prose. Strands lets you pin a schema to the agent's final output, so the answer comes back as a typed object: a title, the root cause, the evidence, a fix with concrete steps, a confidence, and who the fix is actionable by. That last field is what makes the Slack reply speak to the right person instead of dumping a wall of text.
Strict schemas are brittle, though, and a frontier model deep in a long investigation will occasionally return something that almost validates. Throwing that away wastes the whole investigation. So there are two schemas: a strict one, and a tolerant salvage schema that recovers a best-effort answer when the strict parse fails. We keep the strict result when we can and the salvaged one when we must, so the expensive work always produces something a human can use.

7. Guardrails on both sides of the model

Prompt instructions are guidance. Bedrock Guardrails are enforcement, and they sit outside the model where a clever prompt can't argue its way past them. We run them twice, once on the inbound message before any spend, and once on the outbound answer before it reaches Slack. The output guardrail is also one of only two things allowed to escalate a thread to a human. If the agent's answer trips it, a person gets pulled in rather than the message going out. Enforcement sits at the boundary, outside the prompt where the model can't argue with it.

8. The agent can look, but it can't touch

An agent with write access to production is a liability nobody signed up for. This one is read-only by construction. Every AWS investigation tool, whether it is CloudWatch, Lambda, CloudFormation, or IAM inspection, goes through a cross-account STS AssumeRole into a per-account role scoped to read-only. The agent can inspect anything relevant and change nothing.
When a fix genuinely needs elevated access, the agent does not attempt it and does not pretend it can. It works out who the fix is actionable by, whether that is the requester, a tech lead, a pull request, or the platform team, using real permission-set membership from IAM Identity Center. A deterministic guard sits in front of that decision and refuses to assume anyone has elevated access without evidence of the group that grants it. Paging a human on call is the last resort, saved for two cases only: the fix needs privileged production access, or the output guardrail blocked the answer. Everything else, it guides to a fix. Where a fix needs elevated access, the agent stops and hands off to someone who has it.

9. Memory that survives a wait

Real investigations pause. The agent reaches a point where it needs a human, something like "which of these two accounts did you mean?", and it has to wait, sometimes for hours, without losing its place. Two AWS-shaped pieces make that nearly free.
Strands models the pause as a first-class interrupt. When the agent asks its question, the loop stops with an interrupt reason and the thread state, including where to resume, gets persisted. AgentCore Runtime keeps that session alive, so a reply hours later drops the agent back into its reasoning instead of starting from scratch. Snapshots land in S3, encrypted with KMS through the SDK's storage middleware, so nothing sensitive sits in the clear. Encrypted memory that survives for hours, and we wrote none of the persistence layer.

Grounding, and the answer cache that closes the loop

Two more pieces finish the "does not hallucinate, does not repeat itself" story, both riding on AWS primitives.
For grounding, the agent retrieves from a Bedrock Knowledge Base built on our own runbooks and docs, and falls back to a live web search exposed as an MCP tool when the knowledge base has nothing. It reasons over retrieved evidence rather than vibes.
For not solving the same problem twice, every confident answer a human approves is embedded and stored in a vector store on S3. That is the answer-cache rung near the top of the cascade. A new message that is semantically close to a solved one gets the known-good answer straight away, for the price of an embedding lookup. The feedback buttons under every Slack reply, the "did this resolve it?" ones, feed that cache and the flywheel from section 4. Good answers make later answers cheaper and faster.

The war story: the cache TTL bug that escalated everything

Bedrock prompt caching is a real cost lever for an agent, and this next part is the kind of thing you only learn by running it in production. The stable prefix of every investigation, the persona and the tool definitions and the context, is identical on call after call. Cache that prefix and you stop paying to re-read it every time. Two rules make it work, and we learned the second one the hard way.
We got the first rule right by design: put anything dynamic after the cache checkpoint. Our self-improving "lessons" change between runs, so they go after the cache point, while the stable persona-and-tools prefix goes before it and stays cacheable.
const CACHE_TTL = '1h'

function buildSystemPrompt(parts: SystemParts): SystemContentBlock[] {
return [
text(parts.systemPrompt),
text(parts.toolDefs),
text(parts.context),
cachePoint({ ttl: CACHE_TTL }), // stable prefix above stays cacheable
text(parts.lessons), // dynamic content below never invalidates it
]
}
The second rule cost us real incidents. Bedrock processes cache checkpoints in a fixed order, tool config first, then system, then messages, and it requires the TTLs along that order to be non-increasing. We had set the system cache point to one hour. But with automatic caching turned on, the SDK was injecting five-minute checkpoints on the tools, which Bedrock processes before the system block. Five minutes, then one hour, is an increasing TTL. Bedrock rejected the request with a  ValidationException , which the Strands SDK surfaced up to us as a  ModelError . And because it rejected every investigation, the agent fell straight through to its error path and paged a human for each one. From the outside it looked like the agent had lost its nerve and given up on everything at once.
The fix was one line of intent. Pin the tool and message TTLs to the same hour as the system block so the sequence is flat instead of climbing.
const cacheConfig = { strategy: 'auto', toolsTTL: CACHE_TTL, messagesTTL: CACHE_TTL }
If you take one operational detail from this whole article, take this one. With multi-level Bedrock prompt caching, keep your TTLs equal or decreasing in tool then system then message order. An increasing TTL does not degrade gracefully; it fails the entire call. One more thing to watch: the one-hour window applies on the Claude investigation path, while the Nova models honor shorter TTLs, so match the value to the model each path actually uses.

What we have seen change

The bot we deleted deflected most messages and got a lot of them wrong. The agent that replaced it investigates by default and resolves most of what it investigates before a human ever opens the thread. Two things moved in the direction we wanted. Human escalations dropped, because the agent now closes cases that used to page someone at two in the afternoon or two in the morning. And the number of investigations a person runs by hand dropped with them, because when the agent does hand a case over, it arrives with a written root cause and evidence attached, not a raw question that still needs someone to go dig. These are observations from living with the system rather than a measured before-and-after, and I would rather say that plainly than turn a rough impression into a decimal.
The pattern behind both is the same one running through every section above. The agent spends a little more compute so a person spends a lot less attention, and it only asks for that person when the fix genuinely needs a human hand.

A few unglamorous limits

Some boring bounds matter as much as any decision above. The agent loop is capped on both reasoning turns and wall-clock time, so a confused agent fails fast instead of spinning. We separated the per-response token limit from the total loop-output budget, because they are different constraints and conflating them was silently truncating long investigations. And a small resilience layer tells infrastructure failures (throttling, timeouts, 5xx, which retry down the model chain) apart from agent failures (stalls, tool loops, the same question asked three times, which escalate). Without those bounds, an agent that gets stuck just burns time and money until someone notices.

What I'd tell you before you build one

  • Cascade, don't route. Make the cheap steps earn the right to end a conversation, and default to your most capable path rather than your cheapest one.
  • Fail open, toward doing the work. For an assistant, the expensive failure is silence, not a wasted frontier call.
  • Let cost track difficulty, measured by outcomes. A tier that adapts to real approval rates beats one you froze on day one.
  • Keep the author and the verifier separate. An independent judge call is the cheapest confidence you will ever buy.
  • Put enforcement at the boundary. Guardrails and read-only IAM roles hold when a prompt doesn't.
  • Respect the cache rules. Dynamic content after the checkpoint, and non-increasing TTLs in tool then system then message order.
None of these are exotic. What made them cheap to build is that AWS already had a managed service for each hard part. AgentCore for the runtime, the Bedrock family for the model ladder, Guardrails for enforcement, Knowledge Bases for grounding, S3 and KMS for encrypted memory, IAM Identity Center for least privilege. Strands gave us a loop that ties them together with tools, structured output, interrupts, and sessions as first-class ideas. We got to spend our time on the design and let AWS own the plumbing. That is the real reason this went from a bot people ignored to a teammate they trust.

Where to go next

If you are building a platform agent of your own, I would happily compare notes on the cascade thresholds and the self-tuning routing. That is where the interesting tradeoffs still are.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article