<?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: Anshu Kumar</title>
    <description>The latest articles on DEV Community by Anshu Kumar (@anshu_kumar_4a8413f8dfae1).</description>
    <link>https://dev.to/anshu_kumar_4a8413f8dfae1</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%2F3484506%2Fcf8acdd2-4147-4a22-b19d-ea141d8eb1d9.png</url>
      <title>DEV Community: Anshu Kumar</title>
      <link>https://dev.to/anshu_kumar_4a8413f8dfae1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anshu_kumar_4a8413f8dfae1"/>
    <language>en</language>
    <item>
      <title>Your AI agent doesn't need a bigger prompt. It needs better memory.</title>
      <dc:creator>Anshu Kumar</dc:creator>
      <pubDate>Mon, 26 Oct 2026 19:27:09 +0000</pubDate>
      <link>https://dev.to/anshu_kumar_4a8413f8dfae1/your-ai-agent-doesnt-need-a-bigger-prompt-it-needs-better-memory-22eh</link>
      <guid>https://dev.to/anshu_kumar_4a8413f8dfae1/your-ai-agent-doesnt-need-a-bigger-prompt-it-needs-better-memory-22eh</guid>
      <description>&lt;h2&gt;
  
  
  Why AI Agents Shouldn't Keep Learning Through Bigger Prompts
&lt;/h2&gt;

&lt;p&gt;Imagine an AI agent debugging duplicate webhook deliveries.&lt;/p&gt;

&lt;p&gt;It recommends retrying, but the real issue is missing idempotency handling. We fix it by adding another instruction to its system prompt.&lt;/p&gt;

&lt;p&gt;Then another failure happens. Another instruction.&lt;/p&gt;

&lt;p&gt;Eventually, the prompt contains dozens of rules, each written for a different edge case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But should every past mistake become a permanent instruction?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem With Growing Prompts
&lt;/h2&gt;

&lt;p&gt;System prompts are useful for stable rules: permissions, tool contracts, and safety boundaries.&lt;/p&gt;

&lt;p&gt;But lessons learned from specific failures aren't always universally relevant.&lt;/p&gt;

&lt;p&gt;As prompts grow, we introduce unnecessary context, higher token costs, and potentially conflicting instructions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fllz877g5x7sw4w0coj9r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fllz877g5x7sw4w0coj9r.png" alt="Global prompt vs contextual guidance" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What if we stored those lessons separately and retrieved them only when needed?&lt;/p&gt;

&lt;h2&gt;
  
  
  An Architecture I'd Try
&lt;/h2&gt;

&lt;p&gt;I'd separate the system into two loops: &lt;strong&gt;learning and execution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy0jai8q5obuo11q18s9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy0jai8q5obuo11q18s9b.png" alt="Contextual learning architecture" width="799" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Learning loop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After an agent finishes a task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze execution traces and outcomes.&lt;/li&gt;
&lt;li&gt;Identify recurring failure patterns.&lt;/li&gt;
&lt;li&gt;Extract candidate lessons.&lt;/li&gt;
&lt;li&gt;Validate them against previous cases before storing them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"trigger"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"duplicate webhook debugging"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"guidance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Check idempotency before retrying"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"validated"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Execution loop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a new task arrives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identify the task context.&lt;/li&gt;
&lt;li&gt;Retrieve a few relevant lessons.&lt;/li&gt;
&lt;li&gt;Inject them into the current execution.&lt;/li&gt;
&lt;li&gt;Keep unrelated lessons out of the prompt.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A webhook-debugging lesson shouldn't appear during an unrelated database migration.&lt;/p&gt;

&lt;p&gt;This isn't fine-tuning. It's &lt;strong&gt;context-aware guidance retrieval&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hard Part Isn't Retrieval
&lt;/h2&gt;

&lt;p&gt;It's deciding which lessons deserve to be trusted.&lt;/p&gt;

&lt;p&gt;An agent's failure explanation might itself be wrong.&lt;/p&gt;

&lt;p&gt;I'd want every lesson to have supporting evidence, a defined scope, and a way to expire or disable it when circumstances change.&lt;/p&gt;

&lt;p&gt;And importantly, safety rules and permissions must remain global, never dependent on retrieval.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Would We Evaluate It?
&lt;/h2&gt;

&lt;p&gt;I'd compare three approaches:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Strategy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Static prompt&lt;/td&gt;
&lt;td&gt;No accumulated lessons&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Growing prompt&lt;/td&gt;
&lt;td&gt;Append validated lessons globally&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Contextual guidance&lt;/td&gt;
&lt;td&gt;Retrieve relevant lessons per task&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Measure task success, token usage, latency, and regressions on unrelated tasks.&lt;/p&gt;

&lt;p&gt;Contextual retrieval could reduce unnecessary context, but it introduces another risk: failing to retrieve the right lesson.&lt;/p&gt;

&lt;p&gt;So the improvement needs to be measured, not assumed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;I don't think agents need to remember every mistake.&lt;/p&gt;

&lt;p&gt;They need to recognize &lt;strong&gt;which past experience matters for the current task&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Maybe improving agents isn't always about writing better prompts.&lt;/p&gt;

&lt;p&gt;Sometimes it's about deciding &lt;strong&gt;what shouldn't be in the prompt at all.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agenticai</category>
      <category>llm</category>
      <category>architecture</category>
    </item>
    <item>
      <title>When Should an AI Agent Stop?</title>
      <dc:creator>Anshu Kumar</dc:creator>
      <pubDate>Fri, 23 Oct 2026 17:53:26 +0000</pubDate>
      <link>https://dev.to/anshu_kumar_4a8413f8dfae1/when-should-an-ai-agent-stop-38po</link>
      <guid>https://dev.to/anshu_kumar_4a8413f8dfae1/when-should-an-ai-agent-stop-38po</guid>
      <description>&lt;p&gt;&lt;em&gt;Designing a progress-aware execution controller for agentic systems.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Imagine asking an AI research agent to compare PostgreSQL and DynamoDB. It finds documentation, collects the important trade-offs, and has enough information to answer.&lt;/p&gt;

&lt;p&gt;Then it searches again. And again. Same sources, slightly different queries, more tokens spent.&lt;/p&gt;

&lt;p&gt;Now consider the opposite: an agent reaches its step limit one action before completing its work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Both situations point to the same problem: executing more steps isn't always the same as making progress.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I've been thinking about how I'd design an execution controller that makes stopping a &lt;em&gt;system-level decision&lt;/em&gt;, not simply another instruction in the prompt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why &lt;code&gt;max_steps = 10&lt;/code&gt; doesn't solve it
&lt;/h2&gt;

&lt;p&gt;Hard limits are essential. They stop runaway loops and cap resource consumption. But a fixed number of turns doesn't tell us whether a task is complete.&lt;/p&gt;

&lt;p&gt;A simple lookup might need two turns; a difficult research task might need twenty. A generous limit wastes resources on easy tasks. A tight limit can cut complex tasks short.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The limit should be the safety boundary, not the intelligence behind the stopping decision.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The architecture I'd try
&lt;/h2&gt;

&lt;p&gt;I'd separate the agent from the component that controls its execution.&lt;/p&gt;

&lt;p&gt;The agent runtime proposes actions. A policy and budget gate checks them before execution. After a tool returns, a &lt;strong&gt;progress evaluator&lt;/strong&gt; measures what changed, and a &lt;strong&gt;decision controller&lt;/strong&gt; decides what happens next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2dc9xolb1k32hmoxq2aa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2dc9xolb1k32hmoxq2aa.png" alt="Architecture of a progress-aware AI agent with execution monitoring, budget control, and decision management." width="800" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The controller tracks three practical signals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Completion:&lt;/strong&gt; Which task requirements have actually been satisfied, with evidence?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Progress:&lt;/strong&gt; Did the last action add useful information or just repeat earlier work?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Budget:&lt;/strong&gt; How much time, money, and tool usage is left?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, three searches returning the same sources with no newly satisfied requirements could be a sign of stagnation. But it shouldn't immediately kill the task; sometimes a different strategy is all that's needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stop, continue, or change course?
&lt;/h2&gt;

&lt;p&gt;I would start with a transparent, rule-based policy rather than making another LLM judge every step.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F99ru4p1meglxsy9dbuqm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F99ru4p1meglxsy9dbuqm.png" alt="Decision flow for an AI agent to continue, replan, finish, or stop based on progress and budget." width="800" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The outcomes are deliberately different:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FINISH&lt;/strong&gt; - all mandatory requirements are verified.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CONTINUE&lt;/strong&gt; - useful progress is still being made.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;REPLAN&lt;/strong&gt; - the agent appears stuck, but another strategy is allowed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;STOP INCOMPLETE&lt;/strong&gt; - the budget is exhausted or continuing is unsafe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think that final distinction matters. An agent stopping because it ran out of budget should never be confused with an agent successfully finishing its job.&lt;/p&gt;

&lt;h2&gt;
  
  
  One detail that matters in production
&lt;/h2&gt;

&lt;p&gt;The controller's state should be durable: completed requirements, evidence references, tool history, and consumed budget.&lt;/p&gt;

&lt;p&gt;If a worker crashes after spending $0.30 of a $0.50 budget, restarting shouldn't silently reset that budget. And if the previous action changed external state, retries need idempotency or reconciliation-not merely a checkpoint.&lt;/p&gt;

&lt;p&gt;For an MVP, I'd use a small agent runtime, PostgreSQL for execution records, and deterministic policy checks. No elaborate distributed architecture unless the workload actually needs it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I'd know if it works
&lt;/h2&gt;

&lt;p&gt;I wouldn't assume a smarter-looking controller is better. I'd test three policies on the same set of tasks:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Policy&lt;/th&gt;
&lt;th&gt;Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fixed limit&lt;/td&gt;
&lt;td&gt;Stop on completion or at a hard cap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stagnation-aware&lt;/td&gt;
&lt;td&gt;Replan after repeated non-progress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Progress-aware&lt;/td&gt;
&lt;td&gt;Combine completion evidence, stagnation, and soft budgets&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I'd compare &lt;strong&gt;verified task success, cost per successful task, latency, and premature stops&lt;/strong&gt;. The useful question isn't whether the controller reduces calls. It's whether it saves wasted work without making the agent less reliable.&lt;/p&gt;

&lt;p&gt;A simple limit might even win on predictable tasks. That's a valid engineering result too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;I think the next step for agentic systems isn't just making agents capable of doing more. It's giving the systems around them a better way to decide &lt;strong&gt;when more work is useful, when to change strategy, and when to stop&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is a proposed architecture, not a benchmarked result. I'd like to turn it into a small experiment and see where the simple rules break.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sometimes better agent behavior means doing less-but doing it deliberately.&lt;/em&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>architecture</category>
      <category>agents</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
