How to stop an AI agent looping on your API A developer on the Odile Gate team described a gateway service that detects AI agents stuck retrying the same API call and blocks the request before it reaches the upstream API. Odile Gate gives each app its own key and an allow-list of permitted routes, and when an app repeats an identical call the gateway returns a 429 with an x-odile-gate-loop-detected header and fires a webhook alert. The free tier covers 3 apps and 10,000 calls a month, while the Pro plan costs $29 a month for 25 apps and 1,000,000 calls. An agent that hits an error it does not understand often retries the same call, again and again, for as long as it runs. Each call is small, so nothing alarms, but your database, your API bill and your logs fill up. Here is how to stop it. Agents built with Claude Code, Cursor or an agent framework recover from failures by trying again. When the failure is permanent a schema change, a missing record, a 400 they misread , trying again never works, and the agent can keep going until it runs out of turns or budget. A rate limit counts calls per minute. A looping agent can stay under it: three identical calls a second is well inside a normal limit, and it is still 10,000 useless calls an hour. What gives a loop away is not volume but repetition: the same method, path, query and body, over and over, at a machine-steady pace. Code fixes only help code you control. An agent someone else wrote, or one that ignores its limits, still reaches your API. A gateway in front of the API catches it no matter who wrote it. Odile Gate https://odilelabs.com/gate does this on its free tier: each app gets its own key and an allow-list of the calls it may make, and the loop breaker stops an app that keeps sending the same call before the call reaches your API or uses your quota. The stopped call gets 429 with x-odile-gate-loop-detected: true , your webhook gets one message at once, and you can make it stricter or looser for each app. curl -X POST https://gate.odilelabs.com/api/projects -H "content-type: application/json" \ -d '{"name":"Shop API","upstream":"https://api.example.com/v1","header name":"Authorization","header value":"Bearer ..."}' curl -X POST https://gate.odilelabs.com/api/projects/