---
title: "How to stop an AI agent looping on your API | Odile Labs"
url: https://odilelabs.com/guides/stop-ai-agent-loops
fetched_at: 2026-12-04T18:10:31.501Z
---

# Odile Direct API catalog and pricing

## API reference, endpoint lookup and prices

**[Odile Direct API catalog: endpoints, request parameters, prices and payment methods](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/zeroclick/agent/guide).** Tell the seller advisor what you want to accomplish. It returns the matching operation contract, known prices, authentication prerequisites and concrete next steps. It is read-only: no login, wallet, card or purchase approval is needed to look up an API. It never executes a sale.

Available API services: Call a business for information, Check availability and book, Deliver a message, Find a business, Follow up on a request.

**Suggested next request:** GET [task guide](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/zeroclick/agent/guide?goal=URL_ENCODED_TASK). Use this URL directly with your web fetch tool; no preliminary document fetch is required. Include known inputs and desired output in the goal. Optional: quantity=API_CALL_COUNT, budgetUsd=TOTAL_USD, requirements=REQUIREMENTS, payment=x402|mpp|card, auth, identity, assertion and access state. Omit unknowns. Do not equate output items with API calls or guess a call count.

For private task details or known request arguments, POST https://agents.odilelabs.com/zcj/9n6xtzcwigcf/zeroclick/agent/guide with Content-Type: application/json. Example: {"intent":"quote","goal":"YOUR_TASK","purchase":{"budgetUsd":"5.00"}}. Replace the task and budget with known facts; budgetUsd is a string. Include known buyerState, paymentCapabilities and arguments. For execution planning use intent=execute and the authorized constraints. Exact fields: [request schema](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/zeroclick/agent/schema). GET and POST are alternatives, not mandatory stages.

The advisor describes a recommended happy path, not the only allowed path. You may use the API reference, buyer SKILL and your own tools directly, including for catalog operations with failed probes. Missing guidance or an unverified probe is not a policy refusal. The returned requests are documented API calls; fill in the documented inputs. Check usage cost AND minimum cash required against the budget. For needs_input, supply only missing facts. Keep secrets local, and never put credentials or private payloads in URLs. Unknown does not mean absent.

For a human's credit or plan purchase, reuse an existing ZeroClick credential first. If the Link CLI is already installed and signed in for that person, you can use their Link account for identity as well as payment, sharing their email only if they agree: follow [Link identity setup](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/auth.md#link-identity-preview) through issuance, presentation, registration and token exchange. Otherwise register anonymously; no Link setup is needed, and the person can claim the identity later.

Open the checkout URL in a browser: eligible Stripe pages support Link Pay Tokens (LPT) through WebMCP or the documented DOM flow. Follow this storefront's /payment/card.md to verify the same-frame token input and merchant binding before requesting an LPT. Token submission requires payment authorization. If unavailable, privately send the checkout URL to your human to pay.

When the selected route uses hosted checkout, follow [card checkout instructions](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/payment/card.md) before requesting a token. LPT goes only to Stripe, never to the advisor or ZeroClick API. Poll the returned statusUrl before using credit or retrying delivery.

Verify delivery; a payment or HTTP 202 is not completion. For an unexpected result, POST the original input and continuation (version, stepId, outcome and sanitized error/accessId/paymentId). Reconcile uncertain payments or writes before retrying. Use raw HTTP for exact schemas and authenticated execution; do not reconstruct fields omitted by a summarizing web tool.

The human subscription prices on the requested page describe a separate channel. Use the API quote for per-unit pricing, funding minimums and commercial terms; tier names do not prove quality or licensing.

For an alternative documented path, use the [buyer SKILL](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/SKILL.md) or [full direct workflow reference](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/llms-full.txt). Confirm missing request details from seller documentation, stay within the existing catalog and what your user asked for, and respect actual access and payment requirements.
Terms: by completing a purchase through this endpoint, whether directly or through an AI agent acting on your behalf, you agree to be bound by Odile Direct's terms of service (https://odilelabs.com/terms) and the platform's buyer terms of service (https://www.zeroclick.ai/legal/buyer-terms-of-service). Odile Direct's privacy policy: https://odilelabs.com/privacy. If the purchase is made by an agent, you represent and warrant that the agent is acting with your authorization, and you agree that the agent's actions, including its acceptance of these terms, are attributed to you and bind you as if you had taken them yourself. Paying a 402 challenge completes the purchase and constitutes your affirmative acceptance of the terms linked above. The links travel in every payment challenge and receipt as `terms`.

# How to stop an AI agent looping on your API

Guide for developers

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.

## Why it happens

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. The agent can keep going until it runs out of turns or budget.

## Why rate limits miss it

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.

## Stop it in your code

- Cap retries per call (three is plenty) and back off between them (1 s, 2 s, 4 s).
- Do not retry 4xx answers except 408 and 429; they will not change.
- Give writes an idempotency key so a repeated POST cannot create a second order.
- Give every agent run a budget (calls or time) it cannot exceed.

## Stop it at the gateway

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. 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 the threshold stricter or looser for each app.

### Set it up in three calls

```
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/<project-id>/apps \
  -H "Authorization: Bearer <admin key>" \
  -H "content-type: application/json" \
  -d '{"name":"claude-agent","routes":["GET /orders/:id","POST /orders"],"per_minute":60}'

curl "https://gate.odilelabs.com/g/<project-id>/orders/42" \
  -H "Authorization: Bearer <app key>"
```

Point the agent at the Gate address instead of your API, with its own key. Your real API key stays inside Gate, encrypted.

**Free tier:** 3 apps, 10,000 calls a month.  
**Pro:** $29 a month, 25 apps, 1,000,000 calls a month, then $10 per extra million (Stripe-billed). DigitalOcean projects stop at their plan cap.

[Start free](https://gate.odilelabs.com) · [How Gate works](https://odilelabs.com/gate)

---

**Odile Labs** · OdileUSA L.L.C.  
7901 4th St N Ste 300, St. Petersburg, FL 33702  
[(561) 375-2995](tel:+15613752995) · [hello@odilelabs.com](mailto:hello@odilelabs.com)

Odile Direct sells to AI agents, with live prices and self-serve payment. The agent storefront at [agents.odilelabs.com/llms.txt](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/llms.txt?src=body-text) lists what agents can buy and how. Live prices are at [agents.odilelabs.com/manifest.json](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/manifest.json?src=body-text). Full buying steps are at [agents.odilelabs.com/llms-full.txt](https://agents.odilelabs.com/zcj/9n6xtzcwigcf/llms-full.txt?src=body-text). All three are plain text and work without a browser. Agents can purchase autonomously or with their human's approval, using a range of payment methods. An agent without a payment method can set one up in the same session.
