<?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: Barrboss</title>
    <description>The latest articles on DEV Community by Barrboss (@alex_dirochian_59566cbf72).</description>
    <link>https://dev.to/alex_dirochian_59566cbf72</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3806897%2F2f8ce36a-d0d1-489b-9d7f-f1d29f5f72db.png</url>
      <title>DEV Community: Barrboss</title>
      <link>https://dev.to/alex_dirochian_59566cbf72</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alex_dirochian_59566cbf72"/>
    <language>en</language>
    <item>
      <title>My agent burned $147 in ~40 minutes… so I wrote a small circuit breaker</title>
      <dc:creator>Barrboss</dc:creator>
      <pubDate>Thu, 05 Mar 2026 02:30:24 +0000</pubDate>
      <link>https://dev.to/alex_dirochian_59566cbf72/my-agent-burned-147-in-40-minutes-so-i-wrote-a-small-circuit-breaker-4a5e</link>
      <guid>https://dev.to/alex_dirochian_59566cbf72/my-agent-burned-147-in-40-minutes-so-i-wrote-a-small-circuit-breaker-4a5e</guid>
      <description>&lt;p&gt;Last week one of my small AI scripts went off the rails.&lt;/p&gt;

&lt;p&gt;It got stuck retrying a step while streaming responses and kept hitting the API again and again.&lt;/p&gt;

&lt;p&gt;By the time I noticed the usage jumped about $147 in less than an hour.&lt;/p&gt;

&lt;p&gt;So I wrote a small Python “circuit breaker” that stops requests if a rolling token or cost limit is exceeded. It can even cut a streaming response mid-generation.&lt;/p&gt;

&lt;p&gt;Nothing fancy. Just a single Python file that runs locally.&lt;/p&gt;

&lt;p&gt;If this might help someone, I shared it here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/alexdirochian-star/730122004e289bbc6f6b42d4f431656f" rel="noopener noreferrer"&gt;https://gist.github.com/alexdirochian-star/730122004e289bbc6f6b42d4f431656f&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How are you guys preventing runaway token usage in agents?&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>discuss</category>
      <category>python</category>
    </item>
    <item>
      <title>My agent burned $147 in ~40 minutes… so I wrote a small circuit breaker</title>
      <dc:creator>Barrboss</dc:creator>
      <pubDate>Thu, 05 Mar 2026 02:21:21 +0000</pubDate>
      <link>https://dev.to/alex_dirochian_59566cbf72/my-agent-burned-147-in-40-minutes-so-i-wrote-a-small-circuit-breaker-6kb</link>
      <guid>https://dev.to/alex_dirochian_59566cbf72/my-agent-burned-147-in-40-minutes-so-i-wrote-a-small-circuit-breaker-6kb</guid>
      <description>&lt;p&gt;I was testing a small agent script last week and it ended up getting stuck retrying a step while streaming responses.&lt;/p&gt;

&lt;p&gt;It kept calling the API again and again and I didn’t notice for a while.&lt;/p&gt;

&lt;p&gt;By the time I checked the usage it had jumped about $147 in under an hour.&lt;/p&gt;

&lt;p&gt;After that I wrote a small Python “circuit breaker” that stops requests if a rolling token or cost limit is exceeded. It can also interrupt streaming responses mid-generation.&lt;br&gt;
It’s just a single Python file that runs locally. No cloud and no keys leaving your machine.&lt;/p&gt;

&lt;p&gt;If this might help someone, I shared it here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/alexdirochian-star/730122004e289bbc6f6b42d4f431656f" rel="noopener noreferrer"&gt;https://gist.github.com/alexdirochian-star/730122004e289bbc6f6b42d4f431656f&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Curious how others are protecting their agents from runaway API usage?&lt;/p&gt;

</description>
      <category>agents</category>
      <category>discuss</category>
      <category>python</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
