AI Agent Rate Limits: Backpressure and Admission Control
Control AI agent overload with request and token budgets, bounded queues, fair scheduling, and admission rules that protect useful task completion.
Abhishek Raj · · 8 min read
Prepared with AI research assistance. Sources are linked throughout; worked examples are illustrative unless stated otherwise. Editorial approach.
AI agent rate limits become difficult when one user request expands into several model decisions, retrieval queries, and tool calls. Limiting incoming HTTP requests alone does not control that expansion. A useful admission system decides whether the next unit of work may start, reserves the resources it needs, and sends pressure back toward the producer when capacity is unavailable.
This guide proposes an illustrative scheduler for a document-analysis agent. Its quotas, timings, and policies are hypothetical design choices, not provider limits or measured performance results.
Distinguish rate, concurrency, and spending limits
Three controls answer different questions. A rate limit bounds consumption over time. A concurrency limit bounds operations currently in flight. A spending limit bounds expenditure over a longer accounting period. An application can obey any two while violating the third.
Anthropic's current Messages API documentation illustrates why the dimensions matter: requests, input tokens, and output tokens have separate limits. It also explains that brief bursts can exceed enforcement even when a minute-level average looks acceptable. Cache accounting and model groupings are provider-specific, so do not translate one provider's token policy into a universal rule. Claude API rate-limit documentation.
For the proposed scheduler, represent a model call as a resource vector rather than one generic permit:
request_units = 1
estimated_input_units = counted_input
reserved_output_units = application_output_allowance
concurrency_slots = 1
An application output reservation is an internal budgeting policy. It need not match a provider's actual enforcement algorithm. Release or reconcile internal reservations according to the application's own accounting contract and observed usage, without pretending to refund the provider's rolling quota.
Track downstream tools separately. A model endpoint may have spare capacity while an order database or browser pool is saturated. The narrowest bottleneck determines which work can actually proceed.
Put admission before expensive work
A proposed scheduling boundary is: authenticate the task, classify its service tier, estimate its next operation, reserve required capacity, then dispatch. Avoid fetching large documents or creating dozens of worker runs before checking whether the next stage can accept them.
A token bucket offers one way to allow a bounded burst while replenishing capacity over time. Microsoft documents its burst behavior and contrasts it with fixed and sliding windows. The same guidance notes that replica-local counters do not automatically enforce a global limit. Azure throttling pattern.
For this design, use a shared admission service for organization-wide model capacity and local semaphores for process resources. Make the shared reservation atomic across the dimensions it owns. Otherwise two workers can both observe the same remaining input allowance and independently spend it.
A shared counter introduces its own failure policy. During a counter-store outage, allowing every replica to proceed can turn the outage into a provider overload event. Rejecting everything can unnecessarily stop essential work. A possible compromise is a small, explicitly allocated local emergency allowance for selected read-only tasks. That allowance must be partitioned beforehand; it cannot be unlimited capacity disguised as a fallback.
Queue deliberately and bound the wait
A queue changes when work happens; it does not create capacity. In the illustrative service, maintain bounded queues by tenant and task class, with a maximum waiting age and a task deadline. Reject or defer new work when accepting it would produce an unusable result.
Use a scheduling decision with several possible outcomes:
| Outcome | Meaning in this design | Caller behavior |
|---|---|---|
admitted |
Capacity is reserved for a specific operation | Start within the reservation lease |
queued |
Durable work is accepted but not running | Return a job identifier and status |
deferred |
Work has not been accepted | Retry only after the indicated condition |
expired |
The useful completion deadline has passed | Stop and explain the outcome |
Persisting a queued job and acknowledging it establishes an obligation to process or explicitly terminate it. Do not return an accepted job identifier for an entry that exists only in a worker's memory.
Backpressure must reach the agent coordinator. If four research branches are waiting for model permits, the coordinator should stop creating additional branches. Otherwise the bottleneck moves from API calls to stored tasks, memory, and human expectations. See parallel orchestration and backpressure for the fan-out side of the same problem.
Work through a hypothetical capacity decision
Assume an internal operating allowance of 90 model requests, 180,000 input tokens, and 36,000 output tokens per minute. Assume an analysis step typically needs 6,000 input tokens, 1,200 output tokens, and three seconds of service time.
Request capacity alone suggests 90 steps per minute. Input capacity permits 30 such steps, and output capacity also permits 30. Therefore, the illustrative workload is token-bound at 30 steps per minute, or 0.5 steps per second, before reserving headroom for retries and estimation error.
At three seconds per step, a steady flow of 0.5 steps per second corresponds to approximately 1.5 operations in flight on average. That arithmetic is a planning approximation under stable conditions, not a safe concurrency setting by itself. Variable output length, burst arrivals, and latency tails require measurement and bounded headroom.
Now let a coordinator propose five concurrent document workers. Starting them together might consume 30,000 input units immediately even though minute-average consumption remains acceptable. The scheduler checks burst capacity and available concurrency, admits two, and queues three. If the task deadline cannot tolerate that wait, it rejects the proposed decomposition or asks the workflow to reduce scope.
Suppose one worker's document unexpectedly needs 24,000 input tokens. Re-estimate after document selection and before model dispatch. A permit based on the earlier 6,000-token estimate should not authorize arbitrary growth. Split the operation, compact its evidence, or obtain a new reservation under an explicit policy.
Make fairness a scheduling contract
A single FIFO queue gives a tenant submitting hundreds of tasks a long position in front of everyone else. Separate queues make ownership visible, but a naive round-robin scheduler still favors tenants whose jobs consume more tokens per turn.
One proposed policy is weighted deficit scheduling. Give each tenant a service credit, subtract estimated resource cost when dispatching, and carry unused credit forward within a bounded cap. Reserve a small share for interactive tasks while allowing background jobs to borrow idle capacity. Charge every child operation to its originating task and tenant; creating more subagents must not create more entitlement.
There is no single correct conversion from input tokens, output tokens, and tool occupancy into scheduling cost. Define the conversion for your workload, then examine whether tenants receive the intended service over time. Large legitimate jobs may need a separate lane or accumulated credit; otherwise protecting small requests can starve them forever.
Keep authorization separate from fairness. A high-priority task still cannot access another tenant's data or exceed a hard financial boundary. Agent cost budgets should account for the same task lineage without replacing capacity admission.
Adapt to overload without creating a retry storm
AWS's load-shedding account distinguishes useful completed work from raw request throughput and emphasizes overload testing and visibility. That distinction is valuable for agents: admitting more steps is not progress if most expire before their results are usable. Using load shedding to avoid overload.
Measure queue age, accepted-task completion, cancellations before dispatch, provider rejections, estimate error, and per-tenant waiting time. Include admission rejections in availability reporting; hiding them creates an artificially healthy dashboard.
An adaptive concurrency controller can supplement fixed limits. Envoy's documented controller compares sampled latency with a low-load baseline, but its documentation requires control over the relevant concurrency. Treating only one route while bypass traffic reaches the same dependency undermines that assumption. Envoy adaptive concurrency.
For the proposed service, cap adaptation below contractual quotas and increase admission gradually after recovery. Honor provider retry guidance where present, but distinguish transient throttling from a depleted spending cap or invalid configuration. Retries must reacquire admission and consume a bounded retry allowance. A sleeping worker is not a reservation for unlimited future traffic.
Validate behavior under adversarial arrival patterns
Test more than a smooth synthetic average. Send synchronized bursts from several replicas, alternate tiny and huge contexts, delay token-usage reports, expire tasks while queued, and interrupt the shared counter store. Inspect whether total reservations remain bounded and whether expired leases are reclaimed without permitting duplicate dispatch.
Include a tenant that continuously submits work, a large job waiting behind small jobs, and a coordinator that repeatedly proposes new branches. Verify that scheduler behavior matches the documented fairness policy and that cancellation propagates to undispatched descendants.
Record expected outcomes before testing. For example, an expired interactive task should never become a background job without the product's consent policy. A temporary provider rejection should not produce ten independent retries across nested SDK and workflow layers. Failure traces should identify which limiter blocked the operation and which resource estimate it used.
Frequently asked questions
Can a semaphore replace a rate limiter?
No. It bounds in-flight operations, while a fast sequence of calls can still exceed a time-based quota. Use concurrency and rate controls together when both dimensions constrain the dependency.
Should rate-limited agents immediately switch providers?
Only if the fallback has independently reserved capacity and passes the same task requirements. Otherwise switching can move overload elsewhere or change privacy, output, and quality assumptions unexpectedly.
Should queued work hold its model permit?
Usually reserve shortly before dispatch, with a lease for the handoff. Holding scarce permits through a long queue wastes capacity. If an end-to-end workflow needs capacity guarantees, model that as an explicit reservation product rather than an accidental consequence of waiting.
Source reference list
Related reading
- Parallel Agent Orchestration: Fan-Out, Fan-In, and Backpressure
Design parallel AI agent workflows with clear fan-in contracts, bounded concurrency, backpressure, and safe straggler cancellation under real capacity limits.
- AI Agent Cost Management: Budgets, Attribution, and Cost per Task
Control AI agent spending with atomic reservations, complete cost attribution, uncertain-charge recovery, and metrics tied to successful task outcomes.
- AI Agent Retries and Timeouts: Deadlines, Jitter, and Retry Budgets
Design AI agent retries around end-to-end deadlines, classified failures, jitter, shared budgets, and cancellation without multiplying unsafe side effects.