<?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: GN Tech</title>
    <description>The latest articles on DEV Community by GN Tech (@gntechtools).</description>
    <link>https://dev.to/gntechtools</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%2F4151934%2Fdf15c65a-24bf-4712-b48d-04d04e0a653d.png</url>
      <title>DEV Community: GN Tech</title>
      <link>https://dev.to/gntechtools</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gntechtools"/>
    <language>en</language>
    <item>
      <title>Give your AI agent a budget before you give it a wallet</title>
      <dc:creator>GN Tech</dc:creator>
      <pubDate>Wed, 30 Sep 2026 09:49:13 +0000</pubDate>
      <link>https://dev.to/gntechtools/give-your-ai-agent-a-budget-before-you-give-it-a-wallet-2kgf</link>
      <guid>https://dev.to/gntechtools/give-your-ai-agent-a-budget-before-you-give-it-a-wallet-2kgf</guid>
      <description>&lt;p&gt;AI agents can now pay for APIs on their own with x402: the server answers "402 Payment Required", the agent signs a small USDC payment and tries again. No accounts, no API keys. It's a great idea, until a retry loop, a price change or a tampered payment request empties the wallet.&lt;/p&gt;

&lt;p&gt;I run a monitor of the paid x402 APIs that agents can call. On 30 September 2026 it tracked 27,499 of them. 2,777 failed their last health check, and 1,495 charged more than their own directory listing said.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;x402-seatbelt&lt;/strong&gt;: a small, free, open-source npm package that checks every payment before it leaves your machine.&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;wrapFetchWithPayment&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@x402/fetch&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createSeatbelt&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;x402-seatbelt&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seatbelt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createSeatbelt&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;maxTotalUsd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;// budget for all payments&lt;/span&gt;
  &lt;span class="na"&gt;maxPaymentUsd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// no single payment above 5 cents&lt;/span&gt;
  &lt;span class="na"&gt;paySafe&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="c1"&gt;// optional: check each payment first&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchWithPayment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;wrapFetchWithPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seatbelt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Budget and price cap.&lt;/strong&gt; A payment that would cross your limit is never sent, so nothing is paid. Parallel payments reserve their amount, so they can't overshoot together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Emergency stop.&lt;/strong&gt; &lt;code&gt;seatbelt.stop()&lt;/code&gt; blocks everything after it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pay Safe (optional).&lt;/strong&gt; Asks a free service whether the API is working, whether the price is fair compared with its listing and similar services, and whether the wallet is the one that service normally uses. It answers GO, CAUTION or STOP. Only the URL and payment terms are sent, never your keys or signature.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It has no dependencies and runs on Node 18+, Deno, Bun, Cloudflare Workers and browsers. There's a Python version too: &lt;code&gt;agentseatbelt&lt;/code&gt; on PyPI.&lt;/p&gt;

&lt;p&gt;Code and docs: &lt;a href="https://github.com/gmahar82-stack/x402-seatbelt" rel="noopener noreferrer"&gt;https://github.com/gmahar82-stack/x402-seatbelt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm the author, and I'd love to hear what limits your agents need that this doesn't cover yet.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>javascript</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
