<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Soumyaranjan Panda</title>
    <description>The latest articles on DEV Community by Soumyaranjan Panda (@soummyaanon).</description>
    <link>https://dev.to/soummyaanon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1216865%2F764e21b1-2aa4-426c-8955-7601eba41aae.jpg</url>
      <title>DEV Community: Soumyaranjan Panda</title>
      <link>https://dev.to/soummyaanon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/soummyaanon"/>
    <language>en</language>
    <item>
      <title>The Agentic Automation Playbook: Patterns That Actually Hold Up</title>
      <dc:creator>Soumyaranjan Panda</dc:creator>
      <pubDate>Fri, 12 Jun 2026 12:00:00 +0000</pubDate>
      <link>https://dev.to/soummyaanon/the-agentic-automation-playbook-patterns-that-actually-hold-up-1lk0</link>
      <guid>https://dev.to/soummyaanon/the-agentic-automation-playbook-patterns-that-actually-hold-up-1lk0</guid>
      <description>&lt;p&gt;An agent that can do a task &lt;em&gt;once&lt;/em&gt;, while you watch, is a magic trick. It's impressive, and it tells you almost nothing about whether you can leave it running.&lt;/p&gt;

&lt;p&gt;An &lt;em&gt;automation&lt;/em&gt; is a different promise. It says: this job will get done, correctly, a hundred times in a row, on inputs I haven't seen, while I'm asleep — and when it can't, it will tell me instead of quietly making a mess.&lt;/p&gt;

&lt;p&gt;The distance between those two things isn't a smarter model. It's a handful of plays you run every time. None of them are clever. All of them are the difference between a demo and something you'd actually wire to your inbox, your database, or your customers. Here's the playbook.&lt;/p&gt;




&lt;h2&gt;
  
  
  The engine: one small loop
&lt;/h2&gt;

&lt;p&gt;Strip away the jargon and every agentic automation is the same loop running over and over. It looks at the world, decides one thing to do, does it, and then checks whether that actually worked. Repeat until the job is done — or until it's clearly stuck and needs to tap out.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TB
    Start(["📥 Trigger&amp;lt;br/&amp;gt;a job arrives"]) --&amp;gt; Perceive

    subgraph Loop["♻️ THE AGENTIC LOOP"]
        direction LR
        Perceive["👀 Perceive&amp;lt;br/&amp;gt;read the current state"]
        Plan["🧭 Plan&amp;lt;br/&amp;gt;pick the next single action"]
        Act["✋ Act&amp;lt;br/&amp;gt;call one tool"]
        Verify["✅ Verify&amp;lt;br/&amp;gt;did it actually work?"]
        Perceive --&amp;gt; Plan --&amp;gt; Act --&amp;gt; Verify
    end

    Verify --&amp;gt;|"done"| Finish(["🏁 Finish&amp;lt;br/&amp;gt;report what happened"])
    Verify --&amp;gt;|"not yet · budget left"| Perceive
    Verify --&amp;gt;|"stuck · out of budget"| Escalate(["🚨 Escalate&amp;lt;br/&amp;gt;hand to a human"])&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The whole playbook below is really just five ways of making this loop trustworthy. The model lives inside the &lt;strong&gt;Plan&lt;/strong&gt; box — the smallest box in the picture. Everything else is the part &lt;em&gt;you&lt;/em&gt; design.&lt;/p&gt;




&lt;h2&gt;
  
  
  Play 1 — Scope it like a job description, not a wish
&lt;/h2&gt;

&lt;p&gt;The fastest way to get a flaky automation is to ask for too much. "Manage my email" is a wish. "Label each unread email with exactly one topic" is a job. Wishes have no edges, so the agent wanders. Jobs have edges, so the agent finishes.&lt;/p&gt;

&lt;p&gt;A good scope answers four questions up front: what &lt;em&gt;done&lt;/em&gt; means, what inputs it gets, what it's allowed to touch, and when to give up. Write it down as a contract before you write a single prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# A scoped job, not a wish.&lt;/span&gt;
&lt;span class="n"&gt;job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Label every unread support email by topic"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"the unread email"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;allowed_tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"read_email"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"set_label"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# and nothing else&lt;/span&gt;
  &lt;span class="n"&gt;done_when&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"every unread email has exactly one topic label"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;max_attempts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what this buys you: a clear finish line (so the loop knows when to stop), a short list of allowed tools (so it &lt;em&gt;can't&lt;/em&gt; go off-script), and a give-up rule (so it can't run forever). You haven't constrained the intelligence — the model still decides &lt;em&gt;how&lt;/em&gt; to label each email. You've constrained the blast radius.&lt;/p&gt;




&lt;h2&gt;
  
  
  Play 2 — Give it few tools, small and reversible
&lt;/h2&gt;

&lt;p&gt;Every tool you hand an agent is a door it can walk through. The instinct is to hand over a master key — "here's database access, figure it out." Don't. Hand over the smallest, dullest keys that get the job done, and prefer the ones that don't break anything.&lt;/p&gt;

&lt;p&gt;Three rules make a tool safe:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Typed and narrow.&lt;/strong&gt; The tool accepts a specific shape and rejects anything else. It does not "interpret" sloppy input — it refuses it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Least power.&lt;/strong&gt; A "label email" tool can label. It cannot delete, send, or forward. Capability is granted on purpose, never by accident.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reversible first.&lt;/strong&gt; Where you can, prefer actions you can undo — a label you can remove beats a deletion you can't. For the scary stuff, offer a &lt;em&gt;dry run&lt;/em&gt; that reports what &lt;em&gt;would&lt;/em&gt; happen.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tool "set_label":
  input { email_id: string, label: one_of[BUG, BILLING, QUESTION, OTHER] }
  power: least # can label; cannot delete, send, or read other inboxes
  effect: reversible # a label can be removed if it's wrong
  on_bad_input: reject with a clear reason — never guess

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A bare LLM with raw access is a confident intern with the company credit card. The same model behind three small, reversible tools is a teammate who can only do the job you actually gave them. Same intelligence — wildly different risk.&lt;/p&gt;




&lt;h2&gt;
  
  
  Play 3 — Never skip the Verify step
&lt;/h2&gt;

&lt;p&gt;This is the play people drop, and it's the one that matters most. It is tempting to assume that because the tool returned "success," the job is done. It isn't. The tool succeeded; the &lt;em&gt;goal&lt;/em&gt; may not have.&lt;/p&gt;

&lt;p&gt;Real automation closes the loop: after acting, it goes back and reads reality to confirm the world actually changed the way it intended. Act-without-verify isn't automation — it's hope on a schedule.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;act&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;check&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# re-read the world; don't take the tool's word for it&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# feed the failure back into the next Plan&lt;/span&gt;
    &lt;span class="nf"&gt;retry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# the loop runs again — now it knows what went wrong&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The quiet magic here is that last bit: a failed verify isn't a dead end, it's &lt;em&gt;information&lt;/em&gt;. When the reason for failure flows back into the next Plan step, the agent gets a chance to course-correct — which is exactly the thing agents are good at and plain scripts are not. Verification is what turns a guess into a self-correcting loop.&lt;/p&gt;




&lt;h2&gt;
  
  
  Play 4 — Build the escape hatch
&lt;/h2&gt;

&lt;p&gt;An automation that can't fail safely will eventually fail catastrophically. The two ways a loop goes wrong are &lt;em&gt;running forever&lt;/em&gt; and &lt;em&gt;failing silently&lt;/em&gt;. You prevent both with the same move: hard limits, and a loud exit when you hit them.&lt;/p&gt;

&lt;p&gt;Give every run a budget — a maximum number of attempts and a ceiling on cost or time. When it blows the budget, the agent doesn't keep grinding and it doesn't pretend it succeeded. It escalates: it stops, packages up what it was doing, and hands the problem to a human.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="n"&gt;spent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;done&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="no"&gt;MAX_ATTEMPTS&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;spent&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="no"&gt;COST_BUDGET&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;escalate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"hit a wall"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;last_state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# fail loudly, hand off&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;
    &lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;run_loop_once&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;spent&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Escalate to a human" feels like an admission of defeat. It's the opposite. The automations you can trust the most are the ones that know their own limits — they let the agent handle the 95% it's good at and route the weird 5% to someone who can actually decide. A loop with no exit isn't ambitious; it's a runaway bill waiting to happen.&lt;/p&gt;




&lt;h2&gt;
  
  
  Play 5 — Make every run safe to repeat
&lt;/h2&gt;

&lt;p&gt;Because of Play 4, your automation &lt;em&gt;will&lt;/em&gt; retry, and because the world is messy, sometimes it will retry an action it already did. If a retry can double-charge a customer or send the same email twice, you don't have an automation — you have a footgun on a timer.&lt;/p&gt;

&lt;p&gt;The fix is &lt;strong&gt;idempotency&lt;/strong&gt;: make repeating an action a no-op. Give each action a key derived from the job and the operation, and check whether you've already done that exact thing before doing it again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Same job + same action = same key. A retry must never charge twice.&lt;/span&gt;
&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;idempotency_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;already_done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;cached_result&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# we've done this; just return what happened&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;act&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# remember it, so the next retry is safe&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pair this with plain observability — log what the agent perceived, decided, did, and verified at each step. When something does go sideways (and it will), the difference between a five-minute fix and a five-hour mystery is whether you can &lt;em&gt;see&lt;/em&gt; what the loop was thinking.&lt;/p&gt;




&lt;h2&gt;
  
  
  The meta-play: should this even be an agent?
&lt;/h2&gt;

&lt;p&gt;The best automation is sometimes not an agent at all. Agents earn their cost on tasks that need judgment over messy, unpredictable input. For everything else, a plain script is cheaper, faster, and easier to trust. Before you reach for an agent, walk the gate:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    Q1{"Is the task&amp;lt;br/&amp;gt;well-defined and&amp;lt;br/&amp;gt;rule-based?"}
    Q1 --&amp;gt;|yes| Script["⚙️ Write a plain script&amp;lt;br/&amp;gt;cheaper · predictable · testable"]
    Q1 --&amp;gt;|"no — needs judgment&amp;lt;br/&amp;gt;on messy input"| Q2{"Are mistakes&amp;lt;br/&amp;gt;cheap and reversible?"}

    Q2 --&amp;gt;|"no — high stakes"| Human["🧑 Keep a human deciding&amp;lt;br/&amp;gt;the agent assists, doesn't decide"]
    Q2 --&amp;gt;|yes| Q3{"Does it repeat&amp;lt;br/&amp;gt;often enough&amp;lt;br/&amp;gt;to be worth it?"}

    Q3 --&amp;gt;|"no — rare one-off"| Hand["🙋 Just do it by hand"]
    Q3 --&amp;gt;|yes| Agent["🤖 Automate with an agent"]&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;A surprising number of "we need an AI agent" problems are really a script with three &lt;code&gt;if&lt;/code&gt; statements, or a decision that should stay with a person. Knowing when &lt;em&gt;not&lt;/em&gt; to automate is the play that saves you the most pain.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Verdict
&lt;/h2&gt;

&lt;p&gt;Effective agentic automation isn't about a bigger model. It's about a small, honest loop wrapped in five disciplines: &lt;strong&gt;scope it tightly, give it few reversible tools, always verify, build an escape hatch, and make every run safe to repeat.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run those plays and the model gets to do what it's genuinely good at — making judgment calls on messy input — while the structure around it makes sure the job finishes, stays in bounds, and leaves a trail. The demo proves the agent is clever. The playbook is what makes it dependable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.anthropic.com/research/building-effective-agents" rel="noopener noreferrer"&gt;Anthropic — Building effective agents&lt;/a&gt; — why simple, composable patterns beat elaborate frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.kaggle.com/whitepaper-agents" rel="noopener noreferrer"&gt;Google — Agents whitepaper&lt;/a&gt; — the perceive-plan-act loop and tool use, from the ground up.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cdn.openai.com/business-guides-and-resources/a-practical-guide-to-building-agents.pdf" rel="noopener noreferrer"&gt;OpenAI — A practical guide to building agents&lt;/a&gt; — scoping, guardrails, and human handoff in practice.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://martinfowler.com/articles/exploring-gen-ai.html" rel="noopener noreferrer"&gt;Martin Fowler — Exploring Generative AI&lt;/a&gt; — engineering discipline around non-deterministic systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow me here: &lt;a href="https://github.com/soummyaanon" rel="noopener noreferrer"&gt;github.com/soummyaanon&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>automation</category>
      <category>patterns</category>
    </item>
    <item>
      <title>Your AI Agent Works in the Demo. Here's What Breaks in Production</title>
      <dc:creator>Soumyaranjan Panda</dc:creator>
      <pubDate>Mon, 08 Jun 2026 12:00:00 +0000</pubDate>
      <link>https://dev.to/soummyaanon/your-ai-agent-works-in-the-demo-heres-what-breaks-in-production-32da</link>
      <guid>https://dev.to/soummyaanon/your-ai-agent-works-in-the-demo-heres-what-breaks-in-production-32da</guid>
      <description>&lt;p&gt;The demo always works. One prompt, one tool call, a clean answer, and the room nods. Then you put the same agent in front of real users and it starts doing things you never saw coming: repeating itself, calling the wrong tool, confidently doing the wrong thing and leaving no trace of why.&lt;/p&gt;

&lt;p&gt;Here's the uncomfortable part: the model didn't get worse. A demo and a product are just different animals. A demo has to work once, for you. A product has to work a thousand times, for strangers, while things fail around it.&lt;/p&gt;

&lt;p&gt;After building a few of these, the same three gaps show up every time. The agent has no spine, so it doesn't know how to &lt;em&gt;work&lt;/em&gt;. It has no safe hands, so it can't &lt;em&gt;touch&lt;/em&gt; anything without risk. And it has no conscience, so nobody can &lt;em&gt;answer&lt;/em&gt; for what it did. In plainer words: &lt;strong&gt;workflows, APIs, and governance.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What "production-ready" actually looks like
&lt;/h2&gt;



&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TB
    User["👤 User / event&amp;lt;br/&amp;gt;a request comes in"]

    subgraph Agent["🧠 THE AGENT"]
        Reason["Reasoning loop&amp;lt;br/&amp;gt;• picks the next action&amp;lt;br/&amp;gt;• reads the result, decides again"]
    end

    subgraph Flow["🔄 WORKFLOW · the spine"]
        direction LR
        S1["Step&amp;lt;br/&amp;gt;retry + timeout"]
        S2["Checkpoint&amp;lt;br/&amp;gt;resume after a crash"]
        HIL["⏸️ Human approval&amp;lt;br/&amp;gt;when stakes are high"]
        S1 --&amp;gt; S2 --&amp;gt; HIL
    end

    subgraph Gate["🔌 API GATEWAY · the hands"]
        Tools["Typed tools&amp;lt;br/&amp;gt;• validate inputs&amp;lt;br/&amp;gt;• auth + least-privilege scopes&amp;lt;br/&amp;gt;• rate limits"]
    end

    subgraph Ext["🗄️ THE REAL WORLD"]
        direction LR
        DB[("Database")]
        Mail["Email / Slack"]
        Pay["Payments / 3rd-party APIs"]
    end

    subgraph Gov["🛡️ GOVERNANCE · accountability"]
        direction LR
        ID["Identity&amp;lt;br/&amp;gt;who is acting"]
        Pol["Policy&amp;lt;br/&amp;gt;checked before each action"]
        Log["Audit log&amp;lt;br/&amp;gt;what happened + why"]
    end

    User --&amp;gt; Agent
    Agent --&amp;gt; Flow
    Flow --&amp;gt; Gate
    Gate --&amp;gt; Ext
    Gov -. watches .-&amp;gt; Agent
    Gov -. gates .-&amp;gt; Gate
    Gov -. records .-&amp;gt; Ext&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The model is the smallest box in that picture, and that's the point. Everything around it is what turns a clever demo into something you can leave running. Let's take the three pillars one at a time.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Workflows — give the agent a spine
&lt;/h2&gt;

&lt;p&gt;In the demo, the task is one turn: ask, answer, done. Real tasks aren't like that. "Onboard this customer" is six steps, two of which call flaky services, one of which should wait for a human, and any of which can fail halfway through.&lt;/p&gt;

&lt;p&gt;Hand that to a bare LLM loop and you get one of three bad endings: it gives up early, it loops forever, or it quietly skips the step that mattered. The model is good at &lt;em&gt;deciding&lt;/em&gt; the next move. It is terrible at &lt;em&gt;guaranteeing&lt;/em&gt; the whole job finishes.&lt;/p&gt;

&lt;p&gt;That guarantee is what a workflow gives you. You model the task as explicit steps with retries, timeouts, and checkpoints. The agent still chooses what to do at each step, but the workflow makes sure the step actually ran, retries it when the network blips, pauses for a human when the stakes are high, and picks up where it left off if the process crashes. The agent improvises; the workflow remembers.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. APIs — clean hands, not raw access
&lt;/h2&gt;

&lt;p&gt;In the demo, you let the agent run SQL straight against the database, or you hand-roll a one-off function for every little thing it needs. It's fast, and you're the only user. In production, that same direct access is how an agent deletes the wrong rows at 2am over a slightly ambiguous prompt, and that pile of bespoke, untyped tools becomes impossible to secure.&lt;/p&gt;

&lt;p&gt;Every capability the agent has should sit behind an API with a contract: typed inputs you can validate, scoped permissions so a "send email" tool can't also drain a bank account, rate limits, and a clear boundary you can reason about. "Tools," in agent-speak, are really just well-governed APIs wearing a friendly name.&lt;/p&gt;

&lt;p&gt;The bonus is that an API gateway lets you enforce the boring-but-critical stuff — authentication, quotas, logging — in one place, once, instead of re-implementing it inside every agent you'll ever build. The agent gets hands it can use without you holding your breath.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Governance — someone has to answer for it
&lt;/h2&gt;

&lt;p&gt;In the demo, nobody asks what the agent did. In production, the day it emails the wrong customer, approves a refund it shouldn't have, or burns $400 in tokens overnight, someone &lt;em&gt;will&lt;/em&gt; ask: "Why did it do that, and who let it?" If your answer is a shrug, you don't have a product. You have a liability.&lt;/p&gt;

&lt;p&gt;Governance is the unglamorous trio that answers that question:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identity&lt;/strong&gt; — the agent acts &lt;em&gt;as&lt;/em&gt; a specific, scoped identity, not as a vague "the AI." You always know who was on the keyboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Policy&lt;/strong&gt; — what it's allowed to do is checked &lt;em&gt;before&lt;/em&gt; the action, not discovered after. The rules live outside the prompt, where a clever input can't talk its way past them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit&lt;/strong&gt; — every meaningful action leaves an immutable record of what happened and why, so you can explain it, debug it, or prove it later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It sounds like bureaucracy. It's the opposite. Governance is the seatbelt that lets you drive faster — the more you can account for, the more you can safely let the agent do.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tying it together in code
&lt;/h2&gt;

&lt;p&gt;Here's the shape of a single workflow step. Notice how all three pillars show up in a few lines: the workflow drives it, an API client does the touching, and policy plus audit keep it accountable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// One workflow step. The agent proposes; the system stays in charge.&lt;/span&gt;
&lt;span class="c1"&gt;// workflow (spine) · api client (hands) · policy + audit (accountability)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;runStep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AgentContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ToolCall&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// GOVERNANCE — check the policy *before* anything happens.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;decision&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// a real, scoped identity — not "the AI"&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// e.g. "payments.refund"&lt;/span&gt;
    &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;decision&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;audit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"blocked"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;decision&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;decision&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reason&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// tell the agent why, let it adapt&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// APIs — go through a typed, scoped client, never the raw system.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scopedToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// least-privilege credentials, just for this step&lt;/span&gt;
    &lt;span class="n"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// GOVERNANCE — write down what happened, so someone can answer for it later.&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;audit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;identity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;summary&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the workflow is what decides this step runs at all, and what to do when it doesn't:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The spine: retry on failure, pause for a human, survive a crash.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;withRetry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;runStep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nextTool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;tries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;needsApproval&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;pauseForHuman&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// resume later, even after a restart&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;None of this is exotic. It's the same discipline we already apply to any system that touches money, data, or users. We're just pointing it at an agent.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Verdict
&lt;/h2&gt;

&lt;p&gt;The model is not your product. The system around it is. Workflows give the agent a spine so the work actually finishes, APIs give it hands it can use without breaking things, and governance gives it the paper trail that lets you sleep at night.&lt;/p&gt;

&lt;p&gt;Get those three right and most of your "AI bugs" turn out to be ordinary system bugs — the kind you already know how to fix. The demo proves the model is smart. These three pillars are what make it trustworthy.&lt;/p&gt;




&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://tyk.io/blog/ai-and-enterprise-workflows-essential-tools-and-trends-that-tip-the-balance/" rel="noopener noreferrer"&gt;Tyk — AI and enterprise workflows&lt;/a&gt; — the workflow layer for real agent tasks.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://konghq.com/solutions/agentic-ai-workflows" rel="noopener noreferrer"&gt;Kong — Scale and govern agentic infrastructure&lt;/a&gt; — treating agents as API traffic you can manage.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.deloitte.com/us/en/services/consulting/articles/api-governance-agentic-ai.html" rel="noopener noreferrer"&gt;Deloitte — API governance for agentic AI&lt;/a&gt; — where APIs and governance meet.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.ibm.com/think/insights/ai-agent-governance" rel="noopener noreferrer"&gt;IBM — AI agent governance: big challenges, big opportunities&lt;/a&gt; — why accountability is the hard part.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.paloaltonetworks.in/cyberpedia/what-is-agentic-ai-governance" rel="noopener noreferrer"&gt;Palo Alto Networks — Agentic AI governance guide&lt;/a&gt; — identity, policy, and guardrails in practice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow me here: &lt;a href="https://github.com/soummyaanon" rel="noopener noreferrer"&gt;github.com/soummyaanon&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>agenticai</category>
      <category>api</category>
    </item>
  </channel>
</rss>
