15 Research Lab

Research: Rate Limiting Strategies for AI Agent API Calls

15 Research Lab · 2026-02-13

Research: Rate Limiting Strategies for AI Agent API Calls

Abstract

Rate limiting is a fundamental safety control for AI agents that make API calls, yet the optimal rate limiting strategy for agent workloads differs significantly from traditional API rate limiting. 15 Research Lab evaluated four rate limiting approaches against realistic agent workload patterns to determine which strategies best balance safety, cost control, and agent effectiveness.

Why Agent Rate Limiting Is Different

Traditional API rate limiting protects a server from excessive client requests. Agent rate limiting protects the agent operator from excessive costs and unintended consequences caused by the agent's own behavior. This inversion changes the design requirements:

Strategies Evaluated

Strategy 1: Fixed Window

The simplest approach: allow N requests per time window (e.g., 100 requests per minute). The counter resets at each window boundary.

Performance: Adequate for steady-state workloads but poorly suited for agent burst patterns. Agents frequently exhaust the limit during active task execution and then have unused capacity during idle periods. In our testing, fixed window rate limiting caused task failure in 34% of agent sessions due to legitimate bursts hitting the limit.

Strategy 2: Sliding Window

A refinement of fixed window that calculates the rate over a sliding time period rather than fixed boundaries. This smooths the window boundary problem.

Performance: Reduced task failures to 21% compared to fixed window. Still struggles with agent burst patterns because the fundamental approach — counting all requests equally — does not account for the variable impact of different API calls.

Strategy 3: Token Bucket

Allows burst behavior up to a configured bucket size, with tokens replenishing at a steady rate. This accommodates the natural burst pattern of agent work.

Performance: Reduced task failures to 8% — a significant improvement. However, the fixed token replenishment rate does not account for varying API costs. An agent could exhaust its budget on a few expensive calls while the token bucket still shows capacity.

Strategy 4: Cost-Weighted Adaptive

Our proposed approach: each API call consumes rate limit "credits" proportional to its cost (financial cost, risk level, or both). The credit budget adapts based on session duration, task complexity, and historical usage patterns.

Performance: Reduced task failures to 3% while providing the strongest cost control of any approach. Expensive operations consume more credits, naturally limiting the most costly agent behaviors. Adaptive thresholds accommodate varying workload intensities.

Comparative Results

| Metric | Fixed Window | Sliding Window | Token Bucket | Cost-Weighted Adaptive |

|---|---|---|---|---|

| Task Failure Rate | 34% | 21% | 8% | 3% |

| Cost Overrun Incidents | 12% | 10% | 15% | 2% |

| Agent Throughput Impact | -28% | -19% | -7% | -4% |

| Implementation Complexity | Low | Low | Medium | High |

The Retry Amplification Problem

All rate limiting strategies must address retry amplification: the tendency of agents to retry failed requests, which can create a feedback loop that amplifies load during rate limit events.

In our testing, agents without explicit retry policies retried rate-limited requests an average of 4.7 times before giving up. With default exponential backoff, the aggregate load during a rate limit event was 2.3x the normal rate — meaning the rate limit actually increased load in the short term.

Solution: Rate limiting must be coupled with explicit retry policies that the agent respects. The rate limiter should return a clear signal (not just an error code) that the agent interprets as "wait and retry with specified delay" rather than "try again immediately."

Multi-Layer Rate Limiting

Our research recommends a three-layer rate limiting architecture:

Layer 1 — Session Level: Total actions per agent session, preventing runaway sessions regardless of individual API call rates. This is the safety net. Layer 2 — API Level: Per-API rate limits using token bucket or cost-weighted adaptive approaches. This provides targeted control for each external service. Layer 3 — Budget Level: Total cost per session, per day, and per month. This is the financial backstop. SafeClaw supports this multi-layer approach through its action-gating framework. Session-level action limits, per-tool-call evaluation, and budget controls can be configured as policies that the agent must satisfy before each action proceeds. This integrates rate limiting with the broader safety policy framework rather than treating it as a separate concern. Implementation patterns are documented in the SafeClaw knowledge base.

Recommendations

  • Avoid fixed window rate limiting for agent workloads — it conflicts with natural burst patterns
  • Use token bucket or cost-weighted adaptive approaches that accommodate agent behavior
  • Implement explicit retry policies to prevent retry amplification
  • Apply multi-layer rate limiting (session, API, and budget levels)
  • Weight rate limits by cost to prevent budget overruns from expensive operations
  • Conclusion

    Rate limiting for AI agents requires rethinking traditional approaches. Agent workload patterns — bursts, retries, multi-target calls, and variable costs — demand rate limiting strategies that are more sophisticated than fixed or sliding windows. Cost-weighted adaptive approaches provide the best balance of safety, cost control, and agent effectiveness, though simpler token bucket approaches are a reasonable starting point.

    All testing was conducted with synthetic workloads that mirrored production patterns observed in our partner organizations.