<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AI Systems & Architecture Notes]]></title><description><![CDATA[Architectural patterns, production notes, and reference designs for enterprise AI systems—covering deterministic guardrails around LLM workflows, hybrid SQL and]]></description><link>https://ai-systems-lab.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 23:35:18 GMT</lastBuildDate><atom:link href="https://ai-systems-lab.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I Set Up Self-Healing AI Pipelines in Production]]></title><description><![CDATA[Using monitoring agents to catch silent drift early, deciding when a quick Git commit is safe, and knowing when to replicate bugs in a sandbox first.]]></description><link>https://ai-systems-lab.hashnode.dev/how-i-set-up-self-healing-ai-pipelines-in-production</link><guid isPermaLink="true">https://ai-systems-lab.hashnode.dev/how-i-set-up-self-healing-ai-pipelines-in-production</guid><category><![CDATA[ai agents]]></category><category><![CDATA[System Architecture]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Devops]]></category><category><![CDATA[mlops]]></category><dc:creator><![CDATA[Moe]]></dc:creator><pubDate>Mon, 23 Nov 2026 17:58:14 GMT</pubDate><content:encoded><![CDATA[<p>Once you move an AI pipeline into production, keeping it running is a completely different job than building it.</p>
<p>When I ship a pipeline, everything usually runs great for the first few weeks. Then real life happens. An upstream vendor quietly shifts a field on an intake PDF, an internal API renames a JSON key, or users start sending weird edge cases nobody saw during testing. Nothing crashes hard enough to set off server alarms, so dashboards stay green while bad results quietly pile up in the background.</p>
<p>That's why I'm a big believer in building <strong>self-healing pipelines</strong>—where monitoring agents watch production for me 24/7 and catch drift early.</p>
<p>At the same time, whenever people bring up "self-healing AI," the first reaction from any sane engineering or security lead is: <em>"Wait—you're letting an AI change code in production by itself?"</em></p>
<p>No chance. If I let an agent blindly edit live prompts or business logic at 2:00 AM, I'd deserve whatever outage came next. Here is how I actually set this up from start to finish so AI does the heavy lifting, humans stay in control, and we always have a way to roll back.</p>
<hr />
<h2>How the Whole Loop Works (Start to Finish)</h2>
<p>Before getting into the weeds, here is the big picture of how I wire this up. An agent watches the live pipeline, catches drift early, and asks for approval before doing anything—splitting into two completely different tracks depending on how risky the change is:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgICBBWyIxLiBMaXZlIFByb2QgUGlwZWxpbmUiXSAtLT58TWV0cmljcyBhbmQgTG9nc3wgQlsiMi4gTW9uaXRvcmluZyBBZ2VudCBTcG90cyBEcmlmdCJdCiAgICBCIC0tPnxGaW5kcyBSb290IENhdXNlIGFuZCBQaW5ncyBNZXwgQ3siMy4gU21hbGwgb3IgTWFqb3IifQogICAgQyAtLT58U21hbGwgRml4IEFwcHJvdmVkfCBEWyI0QS4gQWdlbnQgQ3JlYXRlcyBHaXQgQ29tbWl0Il0KICAgIEQgLS0-IEVbIjVBLiBEZXBsb3lzIHRvIFByb2QgKyBXYXRjaGVzIE5leHQgUnVucyJdCiAgICBFIC0tPnxTb21ldGhpbmcgQnJlYWtzfCBGWyJSZXZlcnQgR2l0IENvbW1pdCBJbW1lZGlhdGVseSJdCiAgICBFIC0tPnxMb29rcyBHb29kfCBHWyJEb25lIC0gUGlwZWxpbmUgSGVhbGVkIl0KICAgIEMgLS0-fE1ham9yIElzc3VlIEhhbmRzIE9mZiBQcm9kfCBIWyI0Qi4gUmVwbGljYXRlIEJ1ZyBpbiBTYW5kYm94Il0KICAgIEggLS0-IElbIjVCLiBGaXggYW5kIFRlc3QgQWdhaW5zdCBPbGQgQ2FzZXMiXQogICAgSSAtLT4gSlsiNkIuIEhhbmQgTWUgYSBDbGVhbiBQUiB0byBSZXZpZXciXQ?type=png&amp;bgColor=ffffff" alt="End-to-End Self-Healing Architecture" style="display:block;margin:0 auto" />

<p>Let's walk through what happens at each step so you can picture how a real issue moves through this setup.</p>
<hr />
<h2>1. Catching Drift Before Somebody Complains on Friday</h2>
<p>I don't need an AI agent to tell me a server is down—CloudWatch already does that. Where a monitoring agent actually saves me hours is catching <strong>silent drift</strong>.</p>
<p>Say validation retries usually sit around 1%, and on Tuesday afternoon they suddenly creep up to 12%. Or maybe confidence scores drop on one specific form type. Instead of me digging through logs three days later, the monitoring agent notices that shift right away, grabs a failing run, compares it to a clean run from yesterday, and messages me with what changed:</p>
<blockquote>
<p><em>"Hey, intake forms from Partner X started failing date validation 20 minutes ago. The date format changed from MM/DD/YYYY to YYYY-MM-DD."</em></p>
</blockquote>
<p>Right there, 90% of the annoying detective work is already done before I even open my laptop.</p>
<hr />
<h2>2. Drawing a Hard Line: Fix in Prod vs. Go to the Sandbox</h2>
<p>Here is the most important rule in the entire design: <strong>the agent never changes anything without asking first</strong>, and I don't treat every fix the same way.</p>
<p>When the agent proposes a fix, I look at one thing—<strong>what is the blast radius?</strong></p>
<ul>
<li><strong>Small changes (okay for production after I approve):</strong> Things like a shifted date format, a renamed field mapping, or bumping a tight API timeout from 3 seconds to 5 seconds. None of this changes how the core system thinks or makes decisions.</li>
<li><strong>Major issues (hands off production—go to the sandbox):</strong> Anything touching system prompts, agent routing logic, SQL queries, or business rules.</li>
</ul>
<p>If a fix changes <em>how the AI reasons or routes data</em>, <strong>I never let the agent touch production directly.</strong> Even a tiny two-sentence tweak to a prompt can fix today's bug while quietly breaking four other workflows that used to work fine. Major stuff goes straight to the sandbox every single time.</p>
<hr />
<h2>3. Small Changes: Approve It, Commit to Git, and Keep an Undo Button</h2>
<p>Let's say it really is just a minor date-format tweak. I don't want to spin up a two-week sprint ticket for a two-line parser fix. I look at the diff the agent sent me, see that it makes sense, and approve it.</p>
<p>Even then, I enforce two rules so we never get burned:</p>
<ol>
<li><strong>Everything goes through a Git commit.</strong> I never let an agent patch a live container directly in memory. When I approve a small change, the agent commits it cleanly to Git first and ships it through normal deployment. That way I have an exact record of what changed, when it happened, and a clean commit SHA I can revert back to if anything looks off.</li>
<li><strong>Watch the next 100 runs closely.</strong> Once that change goes live, the monitoring agent watches the next batch of production runs. If retries drop back to normal, great—we fixed it in five minutes. If a weird downstream error shows up, we immediately run a Git revert and snap right back to the previous working version.</li>
</ol>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IExSCiAgICBBWyJJIENsaWNrIEFwcHJvdmUiXSAtLT4gQlsiQWdlbnQgUHVzaGVzIEdpdCBDb21taXQiXQogICAgQiAtLT4gQ1siRGVwbG95cyB0byBQcm9kdWN0aW9uIl0KICAgIEMgLS0-IER7IldhdGNoZXMgTmV4dCAxMDAgUnVucyJ9CiAgICBEIC0tPnxFcnJvcnMgRHJvcCB0byBOb3JtYWx8IEVbIktlZXAgdGhlIENoYW5nZSJdCiAgICBEIC0tPnxOZXcgSXNzdWVzIFBvcCBVcHwgRlsiR2l0IFJldmVydCB0byBQcmV2aW91cyBTdGF0ZSJd?type=png&amp;bgColor=ffffff" alt="Fast-Path Production Fix with Git Revert" style="display:block;margin:0 auto" />

<hr />
<h2>4. Major Issues: Replicate It in the Sandbox First</h2>
<p>Now let's talk about the messy cases. Say an upstream change or a new edge case starts causing our agent to misclassify complex records.</p>
<p>When I see an alert like that, I tell the agent: <strong>do not touch production—go replicate this in our sandbox first.</strong></p>
<p>Think about how you or I debug a nasty production issue manually. First, we grab a sample that broke. Next, we try to make it fail the exact same way in dev so we know we aren't guessing. Then we work on the fix and run tests. I make the agent follow that exact same discipline:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgICBBWyIxLiBHcmFiIEJyb2tlbiBQcm9kIFBheWxvYWQiXSAtLT4gQlsiMi4gTWFzayBDdXN0b21lciBQSUkiXQogICAgQiAtLT4gQ1siMy4gUmVwbGF5IEluc2lkZSBTYW5kYm94Il0KICAgIEMgLS0-IERbIjQuIENvbmZpcm0gQnVnIFJlcHJvZHVjZXMiXQogICAgRCAtLT4gRVsiNS4gQWdlbnQgQWRqdXN0cyBQcm9tcHQgb3IgQ29kZSJdCiAgICBFIC0tPiBGeyI2LiBQYXNzZXMgQnVnICsgT2xkIFRlc3RzIn0KICAgIEYgLS0-fE5vfCBFCiAgICBGIC0tPnxZZXN8IEdbIjcuIE9wZW5zIFBSIGZvciBNZSB0byBNZXJnZSJd?type=png&amp;bgColor=ffffff" alt="Sandbox Replay and Fix Loop" style="display:block;margin:0 auto" />

<ol>
<li><strong>Scrub sensitive data first:</strong> Before copying a broken production payload into the sandbox, we mask real customer names, IDs, and SSNs with fake placeholders so real customer data isn't sitting around in dev.</li>
<li><strong>Prove it can replicate the bug:</strong> Before writing any fix, the agent runs that scrubbed payload in the sandbox to confirm it triggers the exact same failure. If it can't reproduce the issue, it stops and tells me instead of guessing blindly.</li>
<li><strong>Make changes in the sandbox and test against old cases:</strong> Once it reproduces the bug, the agent starts adjusting the prompt or code inside the sandbox—running its changes against <em>both</em> the broken case and our historical test cases so we don't play whack-a-mole.</li>
<li><strong>Hand me a Pull Request:</strong> When everything passes in the sandbox, the agent opens a normal Git PR showing what it changed and the test results. Now I can review it calmly, merge it when I'm happy, and promote it cleanly.</li>
</ol>
<hr />
<h2>5. Being Honest About the Risks (What This Solves—and What Still Remains)</h2>
<p>No setup is bulletproof, and pretending there are zero risks is how systems fail in the real world.</p>
<h3>The Risks This Setup Solves</h3>
<ul>
<li><strong>Silent failures don't sit unnoticed for days</strong> because the monitoring agent watches behavior trends, not just server crashes.</li>
<li><strong>No mystery changes in production</strong> because the agent asks first and backs every approved tweak with a real Git commit we can revert anytime.</li>
<li><strong>No live experimentation on risky logic</strong> because prompt and routing issues get forced into an isolated sandbox first.</li>
</ul>
<h3>What Risks <em>Still</em> Exist?</h3>
<p>Even with all of these guardrails in place, there are still three real risks I keep an eye on:</p>
<img src="https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgICBSWyIzIFJpc2tzIEkgU3RpbGwgV2F0Y2giXSAtLT4gUjFbIjEuIENsaWNraW5nIEFwcHJvdmUgVG9vIEZhc3Qgb24gQnVzeSBEYXlzIl0KICAgIFIgLS0-IFIyWyIyLiBNaXNzaW5nIEVkZ2UgQ2FzZXMgaW4gU2FuZGJveCBUZXN0cyJdCiAgICBSIC0tPiBSM1siMy4gQWdlbnQgTG9vcGluZyBhbmQgQnVybmluZyBUb2tlbnMgaW4gU2FuZGJveCJd?type=png&amp;bgColor=ffffff" alt="Residual Risks to Watch" style="display:block;margin:0 auto" />

<ol>
<li><strong>Getting too comfortable and clicking "Approve" without looking:</strong> If the agent nails ten small fixes in a row, it's human nature on a busy Friday afternoon to click <em>Approve</em> on #11 without reading the diff closely. To protect against myself, I put hard limits on which config files are even eligible for quick prod approval—prompts, SQL, and permissions physically require a full PR.</li>
<li><strong>Blind spots in sandbox tests:</strong> When the agent works in the sandbox, it only knows whether it broke the test cases we already have. If our test suite is missing a weird edge case, a bad fix can still look green in the sandbox. My habit is simple: every time a new bug hits production, we save that scrubbed example as a permanent test case so the sandbox gets smarter over time.</li>
<li><strong>Burning tokens in endless sandbox loops:</strong> Sometimes an issue can't be fixed in code because an external partner's API is just sending corrupted garbage. If you don't cap the agent, it'll sit in the sandbox trying 40 different fixes and running up your AWS bill. Always cap sandbox retries (say, 5 attempts max) so it knows when to stop and hand the problem over to a human.</li>
</ol>
<hr />
<h2>Final Thought</h2>
<p>To me, self-healing AI isn't about taking engineers out of the driver's seat. It's about letting agents handle the boring log-hunting and initial legwork while keeping clear boundaries: <strong>quick Git-backed commits for tiny fixes, mandatory sandbox replication for real bugs, and a one-click revert ready at all times.</strong></p>
]]></content:encoded></item><item><title><![CDATA[Moving from Simple Strands Pipelines to Deep Agents on AWS Bedrock]]></title><description><![CDATA[What changes when a 3-step pipeline grows into a multi-step agent, and how I keep context windows, guardrails, and latency under control.]]></description><link>https://ai-systems-lab.hashnode.dev/moving-from-simple-strands-pipelines-to-deep-agents-on-aws-bedrock</link><guid isPermaLink="true">https://ai-systems-lab.hashnode.dev/moving-from-simple-strands-pipelines-to-deep-agents-on-aws-bedrock</guid><dc:creator><![CDATA[Moe]]></dc:creator><pubDate>Mon, 23 Nov 2026 16:54:50 GMT</pubDate><content:encoded><![CDATA[<p>Right now, I’m seeing a lot of engineering teams in the exact same boat.</p>
<p>They started out building simple, clean pipelines using <strong>AWS Strands Agents</strong>. Maybe the agent takes an incoming document, calls two or three Python <code>@tool</code> functions, checks a database, and routes a summary. It’s fast, the code is easy to read, and honestly, it works great.</p>
<p>Then leadership sees the demo and says: <em>"Awesome. Now let’s standardize this on Amazon Bedrock, hook it up to 15 internal systems, and turn it into a 'Deep Agent' that can investigate complex edge cases on its own."</em></p>
<p>That’s usually the exact moment things go sideways.</p>
<p>Jumping from a simple linear pipeline to a deep, multi-step agent isn't just "adding more tools." If you aren't careful, you end up with a slow, expensive system that randomly forgets rules halfway through a task. Here are the three real-world problems you hit immediately—and how I actually solve them.</p>
<hr />
<h2>1. Your Agent Gets "Dumber" After Step 5</h2>
<p>In a simple Strands pipeline, the agent runs two steps and finishes. The prompt stays tiny, and the model stays sharp.</p>
<p>When you move to a <strong>Deep Agent</strong>—where the model has to make a plan, read a 40-page PDF, query claim or account history, check policy rules, and cross-reference notes—all of that raw text piles up inside one giant conversation history.</p>
<p>By step six or seven, the context window is stuffed with thousands of lines of noisy JSON from previous tool calls. Suddenly, the model starts ignoring instructions you put right at the top of your system prompt. Your latency jumps from 2 seconds to 18 seconds, and you're paying for all those junk tokens on every single loop.</p>
<h3>The Fix: Don't Let One Agent Hold Everything</h3>
<p>Instead of one giant agent doing 15 steps in a single memory thread, <strong>split the messy work into subagents</strong>:</p>
<ul>
<li>Have your main orchestrator delegate the heavy digging to a narrow subagent (for example, a <em>Document Lookup Subagent</em>).</li>
<li>Let that subagent read the 40 pages in its own isolated context window, throw away the noise, and return <strong>only a clean 5-line JSON summary</strong> back to the main pipeline.</li>
<li>If you're using the newer <strong>Strands Harness</strong>, lean on built-in context management and prompt caching rather than passing raw database dumps around.</li>
</ul>
<hr />
<h2>2. Where Bedrock Actually Fits (Hint: It Doesn't Replace Strands)</h2>
<p>People often ask me: <em>"If we're moving to Amazon Bedrock, do we throw away our Strands code?"</em></p>
<p>No—they do two completely different jobs, and they're meant to sit together:</p>
<ul>
<li><strong>Strands</strong> is your <strong>code layer</strong>—where your Python logic, tool definitions, and multi-step graphs live in Git so your team can actually test and version them.</li>
<li><strong>Amazon Bedrock</strong> (and <strong>Bedrock AgentCore</strong>) is your <strong>enterprise infrastructure layer</strong>—giving you VPC-isolated models, IAM permissions instead of shared API keys, CloudTrail audit logs, and serverless session hosting that scales down to zero when idle.</li>
</ul>
<pre><code class="language-mermaid">flowchart TD
    A["Incoming Request"] --&gt; B["Bedrock Guardrails (PII &amp; Prompt Check)"]
    B --&gt; C{"Routine Case?"}
    C --&gt;|"Yes (80% Traffic)"| D["Simple Strands Pipeline (Fast &amp; Cheap)"]
    C --&gt;|"No (Complex Edge Case)"| E["Deep Agent Workflow (Planner + Subagents)"]
    D --&gt; F["Deterministic Rules Check"]
    E --&gt; F
    F --&gt; G[("Core System / Human Review")]
</code></pre>
]]></content:encoded></item></channel></rss>