<?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: purrkeyboy</title>
    <description>The latest articles on DEV Community by purrkeyboy (@purrkeyboy).</description>
    <link>https://dev.to/purrkeyboy</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%2F4255074%2Ff4e9aa9f-57f8-420d-b235-e2fea68a529d.png</url>
      <title>DEV Community: purrkeyboy</title>
      <link>https://dev.to/purrkeyboy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/purrkeyboy"/>
    <language>en</language>
    <item>
      <title>What I learned wiring about ten data APIs into AI agents</title>
      <dc:creator>purrkeyboy</dc:creator>
      <pubDate>Fri, 20 Nov 2026 08:29:56 +0000</pubDate>
      <link>https://dev.to/purrkeyboy/what-i-learned-wiring-about-ten-data-apis-into-ai-agents-1mfl</link>
      <guid>https://dev.to/purrkeyboy/what-i-learned-wiring-about-ten-data-apis-into-ai-agents-1mfl</guid>
      <description>&lt;p&gt;I'm building Purrkey, which lets AI agents call third-party data APIs and pay per call. For the last few weeks most of my time has gone into adding upstream providers: social data, search results, web scraping, SEO data, real estate listings. About ten so far.&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%2Forc4gqnuzos0xh1suf6j.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%2Forc4gqnuzos0xh1suf6j.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I expected the work to be about schemas and auth. It mostly wasn't. Here's where the time actually went.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Agents time out, and then they retry
&lt;/h2&gt;

&lt;p&gt;A person clicks a button once. An agent calling a tool can hit a timeout while the upstream call is still running, decide it failed, and call again. Now you've paid the provider twice for the same data.&lt;/p&gt;

&lt;p&gt;The fix: every paid call carries an idempotency key. If the agent comes back with the same key, it gets the original run, finished or still running, instead of a new purchase. Our CLI does this lookup on its own after a lost response. I'd build this first next time, not fifth.&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%2Fbrq70z4dmvw6z35zwth6.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%2Fbrq70z4dmvw6z35zwth6.png" alt=" " width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. You often don't know the price until after the call
&lt;/h2&gt;

&lt;p&gt;Some providers charge a fixed price per request. Others charge per result or per "event", and you only see the bill after the run finishes. One provider's usage numbers kept changing for several seconds after the run reported it was done.&lt;/p&gt;

&lt;p&gt;So the flow became: before the call, hold the most it could cost. After the call, wait until the provider's usage numbers stop moving, settle the real amount, and release the rest. Variable-price calls also get a hard spend cap and a timeout on the provider side, because not every provider lets you abort a run.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Failed calls still cost money
&lt;/h2&gt;

&lt;p&gt;If a scrape errors out or comes back empty, some providers still bill for it. Should the user pay? We decided no. A failed or empty call costs the user nothing, and we absorb the upstream charge. It's cheap at our size and it keeps the promise simple. I log how often it happens so I'll know if that decision starts to hurt.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. "Success" doesn't mean the data is right
&lt;/h2&gt;

&lt;p&gt;Two examples from the same week:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A marketplace source, given a city it didn't recognize, quietly searched a different city. Status 200, plausible results, wrong place.&lt;/li&gt;
&lt;li&gt;A listings source matched a big city name to a small village with a similar name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An agent can't tell. It will happily summarize listings from the wrong city. Now I throw bad inputs at every new endpoint on purpose (unknown cities, typos, empty queries) before it goes live. The known quirks belong in the tool description the agent reads, so it can ask for a clearer input instead of guessing.&lt;/p&gt;

&lt;p&gt;One more: on some providers, a single malformed item fails the whole batch. Better to learn that before a user does.&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%2Fs7pbuoa0ysjb60dh4eid.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%2Fs7pbuoa0ysjb60dh4eid.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Your upstream balance is your uptime
&lt;/h2&gt;

&lt;p&gt;With prepaid providers, running out of balance looks exactly like an outage. One of ours was down to under a dollar before I noticed, and I noticed by accident.&lt;/p&gt;

&lt;p&gt;I've just added a job that checks each provider's balance and alerts our team chat when one runs low. It only alerts. I'm not auto-pausing or auto-topping-up until I've watched real numbers for a while and know what "low" means. When a provider does run dry, the agent gets a clear "upstream quota exhausted" error and the user isn't charged, instead of a vague 500.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Small plans are fine to start
&lt;/h2&gt;

&lt;p&gt;Several of these providers are on free or nearly free plans, a few dollars a month or a handful of credits. Each one also has its own daily budget on our side, so one runaway agent can't burn a month of quota in an afternoon. I'll upgrade plans when usage shows which providers matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell myself a month ago
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Build idempotency and spend holds before adding the second provider.&lt;/li&gt;
&lt;li&gt;Treat every provider's "success" as unverified until you've fed it bad inputs.&lt;/li&gt;
&lt;li&gt;Watch balances from day one.&lt;/li&gt;
&lt;li&gt;Decide early who pays for failed calls, and write it down.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this shows up in a demo, but it's where most of the hours went.&lt;/p&gt;

&lt;p&gt;I'll keep writing these up as I go. If you're building agents that call paid APIs, I'd like to hear what broke for you.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>startup</category>
      <category>buildinpublic</category>
    </item>
  </channel>
</rss>
