<?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: Tanmay Devare</title>
    <description>The latest articles on DEV Community by Tanmay Devare (@tanmay_devare_45).</description>
    <link>https://dev.to/tanmay_devare_45</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%2F3992684%2Fa8e9fc2c-041d-48f2-9f3f-0ef8d04e6615.webp</url>
      <title>DEV Community: Tanmay Devare</title>
      <link>https://dev.to/tanmay_devare_45</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tanmay_devare_45"/>
    <language>en</language>
    <item>
      <title>DedrooM: loop detection + context compression for Claude Code (open source)</title>
      <dc:creator>Tanmay Devare</dc:creator>
      <pubDate>Mon, 06 Jul 2026 10:01:00 +0000</pubDate>
      <link>https://dev.to/tanmay_devare_45/dedroom-loop-detection-context-compression-for-claude-code-open-source-2emf</link>
      <guid>https://dev.to/tanmay_devare_45/dedroom-loop-detection-context-compression-for-claude-code-open-source-2emf</guid>
      <description>&lt;p&gt;I kept running into the same two problems with Claude Code on longer sessions: it'd get stuck retrying a failing command in a near-identical loop, and tool output (file listings, logs, diffs) would pile up in context even after it stopped being useful. Both quietly ran up the token bill.&lt;/p&gt;

&lt;p&gt;So I built DedrooM — a small proxy that sits in front of Claude Code (and a few other agents: Codex, Aider, Cursor, Cline, OpenCode) and does two things:&lt;/p&gt;

&lt;p&gt;Stops loops before they compound. Tracks repeated tool calls with an adaptive window, tightens up automatically once error rate climbs, and blocks a call outright if it's clearly stuck.&lt;br&gt;
Compresses redundant tool output before it hits the model — truncates repetitive stuff like long file listings, dedupes logs, keeps the parts that actually matter.&lt;/p&gt;

&lt;p&gt;It's one command to try:&lt;/p&gt;

&lt;p&gt;bashpip install dedroom&lt;br&gt;
dedroom wrap claude&lt;/p&gt;

&lt;p&gt;dedroom unwrap claude puts things back to normal. It's Apache 2.0, source is here: &lt;a href="https://github.com/Devaretanmay/dedroom" rel="noopener noreferrer"&gt;https://github.com/Devaretanmay/dedroom&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Being upfront about the numbers: the compression/savings figures in the README are from a handful of internal test scenarios, not a big benchmark suite — real savings depend a lot on your workload (loop-prone sessions and repetitive tool output benefit a lot more than a clean session does). I'd rather you try it and tell me it doesn't do much for your setup than oversell it here.&lt;/p&gt;

&lt;p&gt;Would genuinely like feedback from people running long Claude Code sessions — especially if it either catches something useful or gets in your way. Happy to answer questions about how the loop detection or compression actually works under the hood.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>microsoft</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Everyone Is Benchmarking Claude 5. They're Measuring the Wrong Thing.</title>
      <dc:creator>Tanmay Devare</dc:creator>
      <pubDate>Wed, 01 Jul 2026 10:45:12 +0000</pubDate>
      <link>https://dev.to/tanmay_devare_45/everyone-is-benchmarking-claude-5-theyre-measuring-the-wrong-thing-5bgg</link>
      <guid>https://dev.to/tanmay_devare_45/everyone-is-benchmarking-claude-5-theyre-measuring-the-wrong-thing-5bgg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Claude 5 is here.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every timeline is full of benchmark charts.&lt;/p&gt;

&lt;p&gt;SWE-bench scores.&lt;/p&gt;

&lt;p&gt;Coding comparisons.&lt;/p&gt;

&lt;p&gt;Context windows.&lt;/p&gt;

&lt;p&gt;Token pricing.&lt;/p&gt;

&lt;p&gt;But after building runtime infrastructure for AI agents over the last few months, I think we're measuring the wrong thing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Wrong Question&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Everyone is asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"How smart is Claude 5?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I think the better question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"What happens after Claude 5 decides to call a tool?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because that's where production agents actually fail.&lt;/p&gt;

&lt;p&gt;Not during reasoning.&lt;/p&gt;

&lt;p&gt;During execution.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Reasoning Isn't The Hard Part Anymore&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Today's models are incredibly capable.&lt;/p&gt;

&lt;p&gt;They can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write production code&lt;/li&gt;
&lt;li&gt;Search the web&lt;/li&gt;
&lt;li&gt;Execute shell commands&lt;/li&gt;
&lt;li&gt;Modify files&lt;/li&gt;
&lt;li&gt;Query databases&lt;/li&gt;
&lt;li&gt;Call APIs&lt;/li&gt;
&lt;li&gt;Coordinate complex workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difficult part isn't intelligence anymore.&lt;/p&gt;

&lt;p&gt;It's &lt;strong&gt;execution&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;A Failure I Kept Seeing&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;While testing coding agents, I noticed the same pattern over and over again.&lt;/p&gt;

&lt;p&gt;The model wasn't getting dumber.&lt;/p&gt;

&lt;p&gt;It was getting stuck.&lt;/p&gt;

&lt;p&gt;Something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;write_file

write_file

write_file

write_file

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

&lt;/div&gt;



&lt;p&gt;Or this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;execute_shell

read_file

execute_shell

read_file

execute_shell

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

&lt;/div&gt;



&lt;p&gt;The reasoning wasn't changing.&lt;/p&gt;

&lt;p&gt;Only the tool calls were.&lt;/p&gt;

&lt;p&gt;The agent was trapped inside its own execution.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;The Cost Of Runtime Failures&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;These aren't harmless mistakes.&lt;/p&gt;

&lt;p&gt;I've seen agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Burn &lt;strong&gt;40,000+ tokens&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Spend &lt;strong&gt;20+ minutes retrying&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Rewrite the same file repeatedly&lt;/li&gt;
&lt;li&gt;Retry impossible tasks forever&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The model wasn't broken.&lt;/p&gt;

&lt;p&gt;Nobody was supervising execution.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Prompt Engineering Doesn't Fix This&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;A better prompt can improve reasoning.&lt;/p&gt;

&lt;p&gt;It &lt;strong&gt;cannot&lt;/strong&gt; supervise execution after the model has already started making tool calls.&lt;/p&gt;

&lt;p&gt;Once an agent enters a retry loop, telling it to "be careful" doesn't suddenly make it aware that it has repeated the same action ten times.&lt;/p&gt;

&lt;p&gt;Execution needs its own runtime.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;Why I Built MicroLoop&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;MicroLoop sits &lt;strong&gt;between the AI agent and every tool call.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LLM
 │
 ▼
MicroLoop Runtime
 │
 ▼
Tool Execution
 │
 ▼
Result
 │
 ▼
MicroLoop
 │
 ▼
LLM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every action passes through the runtime.&lt;/p&gt;

&lt;p&gt;If the agent begins spiraling into a pathological execution pattern, MicroLoop can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detect repeated execution trajectories&lt;/li&gt;
&lt;li&gt;Interrupt infinite tool loops&lt;/li&gt;
&lt;li&gt;Repair execution paths&lt;/li&gt;
&lt;li&gt;Halt execution when necessary&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal isn't to make models smarter.&lt;/p&gt;

&lt;p&gt;The goal is to stop smart models from making expensive execution mistakes.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;What Existing Benchmarks Don't Measure&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Most AI benchmarks answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can the model solve the task?&lt;/li&gt;
&lt;li&gt;How fast is it?&lt;/li&gt;
&lt;li&gt;How many tokens did it consume?&lt;/li&gt;
&lt;li&gt;What's the pass rate?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are useful.&lt;/p&gt;

&lt;p&gt;But they rarely answer questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How many retries occurred?&lt;/li&gt;
&lt;li&gt;Did the agent enter a loop?&lt;/li&gt;
&lt;li&gt;Did it recover after failure?&lt;/li&gt;
&lt;li&gt;Did it terminate gracefully?&lt;/li&gt;
&lt;li&gt;How much execution was wasted?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are runtime problems.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;That's What I'm Testing Next&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Instead of arguing over benchmark charts, I'm putting Claude 5 through runtime scenarios that resemble real production failures.&lt;/p&gt;

&lt;p&gt;Including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Infinite retry loops&lt;/li&gt;
&lt;li&gt;Impossible tasks&lt;/li&gt;
&lt;li&gt;Recursive tool chains&lt;/li&gt;
&lt;li&gt;Broken execution states&lt;/li&gt;
&lt;li&gt;Tool oscillation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not to prove the model is bad.&lt;/p&gt;

&lt;p&gt;To understand how modern AI agents behave when execution starts going wrong.&lt;/p&gt;




&lt;h1&gt;
  
  
  &lt;strong&gt;The Bigger Picture&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;As models continue getting smarter, I think the bottleneck shifts.&lt;/p&gt;

&lt;p&gt;It won't be reasoning.&lt;/p&gt;

&lt;p&gt;It'll be execution.&lt;/p&gt;

&lt;p&gt;The next generation of AI infrastructure won't just build smarter agents.&lt;/p&gt;

&lt;p&gt;It'll build better runtimes.&lt;/p&gt;

&lt;p&gt;Because in production, intelligence gets the job started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reliable execution gets it finished.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;I'd love to hear how you're handling runtime failures in your own AI agents.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>reviews</category>
      <category>rust</category>
    </item>
    <item>
      <title>Why Prompt Engineering Isn't Enough for Production AI Agents</title>
      <dc:creator>Tanmay Devare</dc:creator>
      <pubDate>Tue, 30 Jun 2026 05:25:07 +0000</pubDate>
      <link>https://dev.to/tanmay_devare_45/why-prompt-engineering-isnt-enough-for-production-ai-agents-m4p</link>
      <guid>https://dev.to/tanmay_devare_45/why-prompt-engineering-isnt-enough-for-production-ai-agents-m4p</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;strong&gt;Autonomous Agents&lt;/strong&gt; frequently get trapped in execution loops, burning through API tokens and compute. Prompt engineering can't guarantee execution safety. I built &lt;strong&gt;MicroLoop&lt;/strong&gt;, an &lt;strong&gt;open source&lt;/strong&gt; &lt;strong&gt;runtime safety&lt;/strong&gt; layer written in &lt;strong&gt;Rust&lt;/strong&gt;, to intercept and verify every &lt;strong&gt;tool calling&lt;/strong&gt; operation before it executes. Here is the architecture and why Rust was the only logical choice for modern &lt;strong&gt;AI infrastructure&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;As &lt;strong&gt;AI Agents&lt;/strong&gt; become more capable, they're being trusted with increasingly complex, multi-step workflows. They search the web, interact with APIs, execute code, query databases, and coordinate multiple tools to complete tasks.&lt;/p&gt;

&lt;p&gt;But after building and deploying &lt;strong&gt;autonomous agents&lt;/strong&gt; to production, I kept running into the same expensive problem. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;LLM&lt;/strong&gt; wasn't failing because it lacked intelligence. It was failing because nobody was verifying what happened &lt;em&gt;after&lt;/em&gt; the model decided to call a tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hidden Cost of Autonomous Agents
&lt;/h2&gt;

&lt;p&gt;A typical AI agent architecture looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ User ] 
   │
   ▼
[ LLM ] ──(decides)──&amp;gt; [ Tool Call ]
                            │
                            ▼
                         [ Tool ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Most &lt;strong&gt;popular frameworks&lt;/strong&gt; assume that if the model decides to call a tool, the call should be executed blindly. In reality, agents often:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Call the same tool repeatedly with identical arguments.&lt;/li&gt;
&lt;li&gt;Retry failed operations indefinitely.&lt;/li&gt;
&lt;li&gt;Generate malformed JSON or invalid arguments.&lt;/li&gt;
&lt;li&gt;Consume thousands of unnecessary tokens.&lt;/li&gt;
&lt;li&gt;Get trapped in silent execution loops.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider a browser agent that encounters an unexpected CAPTCHA page. Instead of changing strategy, it may repeatedly execute open_page() in an infinite loop. Or a coding agent might continuously run pytest on a broken file.Nothing changes, but the agent continues spending time, tokens, and compute. These aren't model intelligence problems. They are runtime execution problems.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Prompt Engineering Fails at Runtime Safety
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The most common solution to this is to add a system prompt&lt;/strong&gt;&lt;br&gt;
"You are an autonomous agent. Do not repeat tool calls. If a tool fails twice, change your strategy.Unfortunately, prompts aren't guarantees. They are suggestions."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A probabilistic model can still&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retry the same failing action. &lt;/li&gt;
&lt;li&gt;Ignore previous failures due to context window degradation.&lt;/li&gt;
&lt;li&gt;Produce malformed tool arguments.&lt;/li&gt;
&lt;li&gt;Continue executing an unsafe trajectory. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As agents become more &lt;strong&gt;autonomous&lt;/strong&gt;, relying solely on prompts becomes increasingly fragile. Runtime safety shouldn't depend entirely on model behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introducing MicroLoop&lt;/strong&gt;: A Runtime Verification Layer&lt;br&gt;
Instead of trying to make the model perfect**&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I started asking a different question What if every tool call was cryptographically and logically verified before it executed? That's the idea behind MicroLoop.&lt;br&gt;
MicroLoop is a lightweight runtime safety layer that sits directly between an AI agent and its tools. Rather than replacing existing frameworks, it acts as a transparent proxy alongside them.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ Agent ]
    │
    ▼
[ MicroLoop ] ──(verifies)──&amp;gt; [ Allow / Block ]
    │
    ▼
[ Tool ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Every single tool invocation is inspected in real-time before execution is permitted.&lt;/p&gt;
&lt;h2&gt;
  
  
  Under the Hood: How MicroLoop Works
&lt;/h2&gt;

&lt;p&gt;Each tool call passes through a strict, low-latency verification pipeline&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;History Tracker&lt;/strong&gt;: Detects repeated execution patterns (identical tool calls, repeated arguments, error loops, excessive retries). If a dangerous trajectory is detected, execution is blocked before the tool runs.&lt;br&gt;
&lt;strong&gt;Rule Engine&lt;/strong&gt;: Performs deep validation using JSON Schema, Regex rules, exact value matching, and per-tool execution policies.&lt;/p&gt;

&lt;p&gt;This allows MicroLoop to enforce strict AI Agent Security and runtime policies without requiring you to rewrite your agent's core logic.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why Rust?
&lt;/h2&gt;

&lt;p&gt;Building High-Performance AI Infrastructure&lt;br&gt;
Because verification happens synchronously before every tool call, latency is the enemy.If your safety layer adds 50ms of overhead per tool call, your agent becomes unusable.&lt;/p&gt;

&lt;p&gt;This is why MicroLoop is written entirely in Rust with a lightweight no_std core, making it suitable for highly performance-sensitive environments and edge deployments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Current Benchmarks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;~17 μs average verification time&lt;/li&gt;
&lt;li&gt;~375 ns adversarial loop rejection&lt;/li&gt;
&lt;li&gt;~58,000 verifications per second&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To ensure it plays nicely with the broader Python-heavy AI ecosystem, the project exposes a C ABI. This allows seamless integration from virtually any language, with native Python adapters already available for LangChain, LangGraph, CrewAI, and AutoGen.&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;# Example: Wrapping a LangChain tool with MicroLoop
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;microloop&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Guardrail&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;

&lt;span class="n"&gt;guard&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Guardrail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;policy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;strict_loop_detection&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="nd"&gt;@guard.verify&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;query_database&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Executes a SQL query. MicroLoop intercepts repetitive calls.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Beyond Loop Detection The Future of AI Agent Security
&lt;/h2&gt;

&lt;p&gt;Loop detection is only the first step in runtime safety. The same execution layer architecture is perfectly positioned to support&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prompt Injection Detection (analyzing tool outputs before      they hit the context window)&lt;/li&gt;
&lt;li&gt;Tool Permission Enforcement (RBAC for agents)&lt;/li&gt;
&lt;li&gt;Dynamic Budget Limits (hard halts on token/compute spend)&lt;/li&gt;
&lt;li&gt;Secret Protection (blocking PII or API keys from leaking into tool payloads)&lt;/li&gt;
&lt;li&gt;Audit Logging &amp;amp; State Repair&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As AI Agents transition from weekend demos to mission-critical production infrastructure, I believe runtime verification will become as fundamental as logging, authentication, and observability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
Prompt engineering tells an agent what it should do.&lt;br&gt;
Runtime safety verifies what it is actually doing.&lt;br&gt;
That's the gap I'm exploring with MicroLoop. The project is fully open source, and I'd love feedback from the community on the architecture, API design, and runtime approach.&lt;/p&gt;

&lt;p&gt;👇 I'd love to hear from you: If you're building autonomous agents in production, how are you handling execution safety and infinite loops today? Let me know in the comments!&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Devaretanmay" rel="noopener noreferrer"&gt;
        Devaretanmay
      &lt;/a&gt; / &lt;a href="https://github.com/Devaretanmay/microloop" rel="noopener noreferrer"&gt;
        microloop
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Microloop&lt;/h1&gt;
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A zero-dependency drop-in infinite loop detector for autonomous coding agents.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667"&gt;&lt;img src="https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667" alt="License"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer" href="https://github.com/tanmaydevare/microloop/actions/workflows/rust.yml/badge.svg"&gt;&lt;img src="https://github.com/tanmaydevare/microloop/actions/workflows/rust.yml/badge.svg" alt="Build"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Microloop prevents autonomous AI agents from falling into infinite loops by intercepting redundant trajectories.&lt;/p&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;30-Second Quick Start&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Microloop acts as a middleware. To use it as an upstream proxy in front of an LLM:&lt;/p&gt;
&lt;div class="highlight highlight-source-shell notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; 1. Start the proxy&lt;/span&gt;
cargo run --release --bin microloop-proxy

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; 2. Point your agent to the proxy&lt;/span&gt;
&lt;span class="pl-k"&gt;export&lt;/span&gt; TARGET_API_URL=&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;http://127.0.0.1:20128/v1&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Architecture&lt;/h2&gt;

&lt;/div&gt;

  &lt;div class="js-render-enrichment-target"&gt;
    &lt;div class="render-plaintext-hidden"&gt;
      &lt;pre&gt;sequenceDiagram
    participant Agent as Autonomous Agent
    participant Microloop as Microloop Core
    participant LLM as LLM Provider
    
    Agent-&amp;gt;&amp;gt;Microloop: Step 1: Tool Execution
    Microloop-&amp;gt;&amp;gt;Microloop: Hash Trajectory State
    Microloop--&amp;gt;&amp;gt;Agent: Proceed (Unique state)
    Agent-&amp;gt;&amp;gt;LLM: Generate next step
    
    Agent-&amp;gt;&amp;gt;Microloop: Step 2: Identical Tool Execution
    Microloop-&amp;gt;&amp;gt;Microloop: Hash Trajectory State
    Microloop--&amp;gt;&amp;gt;Agent: BLOCK (Loop Detected)
    Note over Agent: Agent is forced to pivot
&lt;/pre&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;span class="js-render-enrichment-loader d-flex flex-justify-center flex-items-center width-full"&gt;
    &lt;span&gt;
      &lt;span class="sr-only"&gt;Loading&lt;/span&gt;
&lt;/span&gt;
  &lt;/span&gt;


&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Demonstration&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;&lt;em&gt;(GIF Placeholder)&lt;/em&gt;&lt;/p&gt;


&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;Installation&lt;/h2&gt;

&lt;/div&gt;
&lt;p&gt;Microloop is a C-compatible shared library &lt;code&gt;no_std&lt;/code&gt; core.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Rust&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;Add this to your &lt;code&gt;Cargo.toml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight highlight-source-toml notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;[&lt;span class="pl-en"&gt;dependencies&lt;/span&gt;]
&lt;span class="pl-smi"&gt;microloop&lt;/span&gt; = &lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Devaretanmay/microloop" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;If you found this architectural breakdown helpful, consider leaving a ❤️ and following for more deep dives into AI infrastructure and Rust!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rust</category>
      <category>opensource</category>
      <category>langchain</category>
    </item>
    <item>
      <title>How to fix LangGraph GraphRecursionError without losing your checkpointed state</title>
      <dc:creator>Tanmay Devare</dc:creator>
      <pubDate>Fri, 19 Jun 2026 17:47:59 +0000</pubDate>
      <link>https://dev.to/tanmay_devare_45/how-to-fix-langgraph-graphrecursionerror-without-losing-your-checkpointed-state-3mag</link>
      <guid>https://dev.to/tanmay_devare_45/how-to-fix-langgraph-graphrecursionerror-without-losing-your-checkpointed-state-3mag</guid>
      <description>&lt;p&gt;We’ve all been there. You leave your LangGraph agent running overnight. It hits a 403 Forbidden on a scraping tool, or a REQUIRES_SINGLE_PART_NAMESPACE error on a SQL query.&lt;br&gt;
Instead of failing gracefully, the agent asks the LLM for help. It gets stuck in a ReAct loop, burning through your API credits. Eventually, the native recursion_limit finally kills it.&lt;br&gt;
But here is the worst part: the native recursion_limit is a blunt instrument.&lt;br&gt;
When it hits the limit, LangGraph throws a GraphRecursionError. It crashes the run, wipes your checkpointed state, and returns a 500 error to your frontend user. You lose whatever partial data the agent did gather, and you get a surprise $4,000 API bill on Tuesday morning.&lt;br&gt;
I spent the last month digging into why agents do this, especially with open-weight models (Qwen/Llama) that lack native self-correction. I realized that just throwing a raw RuntimeError or a "BLOCKED" string at an agent just confuses it, and it loops again.&lt;br&gt;
Here is how we solved it using Pre-Model Intervention and Atomic Transcript Surgery.&lt;br&gt;
The Architecture: Intercepting Before the Crash&lt;br&gt;
Most guardrails wrap the entire graph or monkey-patch the HTTP client. This adds latency and breaks framework internals.&lt;br&gt;
Instead, we use LangGraph’s native pre_model_hook and ToolNode APIs. This allows us to intercept the agent before the next LLM call, mutate the ephemeral prompt, and force a strategy pivot without corrupting the user's checkpointed state.&lt;br&gt;
We call it the Progressive Intervention Protocol:&lt;br&gt;
Nudge: Injects an ephemeral warning into the tool result.&lt;br&gt;
Override: Safely strips the failing tool_calls from the prompt (preventing OpenAI/Anthropic 400 Bad Request validation errors) and forces a text-based strategy pivot.&lt;br&gt;
Hard Stop: Halts the graph but preserves the checkpointed state so you get partial results instead of a crash.&lt;br&gt;
The 1-Line Fix&lt;br&gt;
We open-sourced this engine as TokenCircuit. It uses zero-dependency semantic shingling (stdlib regex + hashlib) to catch paraphrased loops at &amp;lt;20µs latency.&lt;br&gt;
Here is how you wrap your LangGraph agent:&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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langgraph.prebuilt&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_react_agent&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tokencircuit.adapters.langgraph&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tc_pre_model_hook&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TokenCircuitToolNode&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tokencircuit&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TokenCircuitConfig&lt;/span&gt;

&lt;span class="c1"&gt;# 1. Configure the intervention engine
&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TokenCircuitConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;max_repeats&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;window_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;telemetry_enabled&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Logs interventions locally or to Supabase
&lt;/span&gt;    &lt;span class="n"&gt;agency_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my-org&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;client_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my-app&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 2. Wrap your tools with TokenCircuit's transaction tracking
&lt;/span&gt;&lt;span class="n"&gt;safe_tool_node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TokenCircuitToolNode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 3. Inject the pre-model hook for transcript surgery
&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_react_agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;safe_tool_node&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;pre_model_hook&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;tc_pre_model_hook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;node_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;agent&lt;/span&gt;&lt;span class="sh"&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;# Run your agent exactly as before
&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agent&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;messages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;HumanMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Get me the stock price for AAPL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)]})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why This Matters for Production&lt;br&gt;
When you deploy autonomous agents for clients, you can't afford silent loop failures.&lt;br&gt;
With TokenCircuit V8.1, we achieved zero core dependencies. We swapped pydantic for @dataclass(slots=True) and tiktoken for stdlib shingling. This means:&lt;br&gt;
Zero supply-chain vulnerabilities.&lt;br&gt;
&amp;lt;20µs overhead per turn.&lt;br&gt;
100% local execution. No prompts or PII ever leave your RAM.&lt;br&gt;
We also built a local CLI report generator. When an intervention happens, it logs to a local NDJSON file. You can run tokencircuit report --file events.json to generate a board-ready table showing exactly how many tokens and dollars your guardrail saved.&lt;br&gt;
The Code is Open Source&lt;br&gt;
If you are tired of watching your agents burn money on infinite loops, check out the repo.&lt;br&gt;
GitHub: &lt;a href="https://github.com/Devaretanmay/TokenCircut" rel="noopener noreferrer"&gt;https://github.com/Devaretanmay/TokenCircut&lt;/a&gt;&lt;br&gt;
PyPI: pip install "tokencircuit[langgraph]"&lt;br&gt;
Question for the builders: What’s the most money an agent has burned for you in a single night? Drop your war stories in the comments. 👇&lt;/p&gt;

</description>
      <category>ai</category>
      <category>langchain</category>
      <category>python</category>
      <category>agents</category>
    </item>
  </channel>
</rss>
