<?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: Dyordo</title>
    <description>The latest articles on DEV Community by Dyordo (@dyordo).</description>
    <link>https://dev.to/dyordo</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%2F4190210%2Fb7b26bed-684f-4482-a80a-92bc43df531a.png</url>
      <title>DEV Community: Dyordo</title>
      <link>https://dev.to/dyordo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dyordo"/>
    <language>en</language>
    <item>
      <title>A $37 bill taught me to put spending limits on my AI agents</title>
      <dc:creator>Dyordo</dc:creator>
      <pubDate>Sun, 18 Oct 2026 03:41:44 +0000</pubDate>
      <link>https://dev.to/dyordo/a-37-bill-taught-me-to-put-spending-limits-on-my-ai-agents-1df8</link>
      <guid>https://dev.to/dyordo/a-37-bill-taught-me-to-put-spending-limits-on-my-ai-agents-1df8</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://dyordo.com/en/ai-tools/ai-agent-spending-guardrails/" rel="noopener noreferrer"&gt;dyordo.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Last month I gave a research agent an API key with a shared limit and pointed it at a competitor-monitoring job. The job was small: at most 50 calls a day, each costing a fraction of a cent.&lt;/p&gt;

&lt;p&gt;On the third night the bill said $37 for one day.&lt;/p&gt;

&lt;p&gt;A subtask had fallen into an error loop. Call fails, agent tweaks a parameter, retries, fails again. My 50-call cap didn't stop it, because each endpoint had its own quota and my limit didn't cover all of them.&lt;/p&gt;

&lt;p&gt;$37 is not a disaster. But it showed me I had never designed how my agents spend money. I had given each one a card that works, not an account with a budget.&lt;/p&gt;

&lt;p&gt;Here is what I do now. None of it needs new infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Split the budget by purpose
&lt;/h2&gt;

&lt;p&gt;One monthly number per agent is too blunt. I use three buckets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exploration: $5 to $20 a week for trying APIs. When it's gone, the agent waits until next week.&lt;/li&gt;
&lt;li&gt;Project: a fixed amount loaded for one task, like $10 to scrape pricing for a list of competitors. Unspent money comes back when the task ends.&lt;/li&gt;
&lt;li&gt;Escalation: anything above the threshold needs my approval. The agent asks. It doesn't just spend.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Set the limit before the agent starts. Trimming after it overspends teaches it nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Allow-list, don't block-list
&lt;/h2&gt;

&lt;p&gt;I used to allow everything and block bad services as they showed up. Every new service was a new risk, and I was always behind.&lt;/p&gt;

&lt;p&gt;Now nothing is allowed by default:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with services you already trust, like OpenAI, Anthropic and your existing data sources.&lt;/li&gt;
&lt;li&gt;Add new ones one at a time, after checking them.&lt;/li&gt;
&lt;li&gt;If an agent wants a new service, it requests it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The allow-list also carries numbers. I cap spend per call and per day. A rule like "max $5 a day, 200 calls a day" would have killed my retry loop in round three.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cap single transactions and watch for anomalies
&lt;/h2&gt;

&lt;p&gt;A healthy total says nothing about one transaction. Every agent account I run has a hard rule: any single charge over $2 goes to a human.&lt;/p&gt;

&lt;p&gt;On top of that, an unusual call rate, failure rate or spend speed freezes the account. The cheapest version is one condition: the agent can spend only if budget &amp;gt; 0 and no anomaly flag is set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give the agent a visible owner
&lt;/h2&gt;

&lt;p&gt;When an agent calls third-party services, it should say who it works for, for example a handle like &lt;code&gt;yourname.cloudflare.pay&lt;/code&gt;, instead of showing up as an anonymous account.&lt;/p&gt;

&lt;p&gt;Merchants are more likely to hand out trial credits to an agent with a known owner, and more likely to email you than ban you when something looks off. Same reason people trust &lt;code&gt;yourname.com&lt;/code&gt; and not a bare IP and port.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things to do this week
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;List every paid service your agents call and what each costs per month. The total is usually higher than you think.&lt;/li&gt;
&lt;li&gt;Give each main agent one budget number, then enforce it in code, not in a note.&lt;/li&gt;
&lt;li&gt;One agent, one API key. Separate bills, separate limits, and you can shut one down without touching the others.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This takes under an hour.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hard limits buy you freedom
&lt;/h2&gt;

&lt;p&gt;With a $10 cap, I can let an agent try 50 services without watching any of them. With a $1,000 account and no cap, I check the bill at 2 a.m.&lt;/p&gt;

&lt;p&gt;That's why I like Cloudflare's two-tier wallet design: it turns "do I trust this agent?" into "what's the cap?"&lt;/p&gt;

&lt;p&gt;On a normal day, a well-limited agent system shows the occasional "budget exhausted, paused" notice. You top it up or adjust it and move on. You don't wake up and open the bill first.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Prices and policies change. Check official docs before you buy anything.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>llm</category>
      <category>security</category>
    </item>
  </channel>
</rss>
