Rate Limiting AI Agents: What to Cap and Where
Rate limiting AI agents means capping how often, how much and how long agents may act: requests per session, messages between agents, tool calls per run, money per run, and the number of agents itself. Agents need these limits more than people do because they work in parallel, never tire, and retry when something fails, so a mistake that a person would make once an agent can make a thousand times a minute. The limits belong on the server, checked inside the write, and every refusal should tell the agent which rule refused and what to do next. This guide covers the five kinds of limit, where to enforce each one, and a starting set of numbers with where they came from.
Why rate limiting AI agents differs from limiting people
Rate limits for people assume a person: one at a time, a few requests a minute, stopping when something looks wrong. Agents break each assumption.
- Parallel. One planner can start hundreds of agents, all arriving at once. A limit per account that suits one person is exhausted in seconds.
- Tireless. An agent does not get bored of a failing loop. Without a cap it will retry the same test, or ask the same question, until something stops it.
- Retrying. Agents and their tools retry on errors. A server that answers "busy" without saying when to come back invites a stampede of retries.
- Talking to each other. Two agents that message each other can enter a loop that costs tokens on both sides and produces nothing.
OWASP's Top 10 for LLM applications names the general risk "Unbounded Consumption" and lists the matching controls: "Apply rate limiting and user quotas to restrict the number of requests a single source entity can make", and "Set timeouts and throttle processing for resource-intensive operations" (read 27 Nov 2026). For agents, "a single source entity" needs a careful definition: is it the person, the API key, or the session?
Five kinds of limit
| Kind | Unit | What it stops | Example numbers (Forkit) |
|---|---|---|---|
| Requests | Per session, under a ceiling per key | One runaway session starving the rest | 240 a minute per session; 30,000 a minute per key |
| Messages between agents | Per sender, per recipient, per pair | Chat loops, inbox floods | 30 a minute per session, 600 per key; 50 unread per recipient; 20 per pair of agents until a person writes |
| Tool calls | Per run | An agent (or many) doing far more than the job needs | max_tool_calls on a fan-out |
| Money | Per run | A run spending past its budget | max_cost_usd: warn at 80%, stop at 100% |
| Agents | Per run and per month | One run growing beyond what was intended | Plan limits on fan-out size and monthly agents |
1. Requests per session, under a ceiling per key
Count requests per agent session, not only per key. If 200 agents share a key, a per-key limit lets one busy agent use up the budget for all of them; a per-session limit keeps each fair. Then add a much higher ceiling per key, so a bug that creates sessions in a loop still hits a wall.
Forkit's limits: 240 requests a minute per agent session (the hook sends a session header; without it, per key), under 30,000 a minute per key. A request is counted once, even where routes are mounted twice.
Exempt long waits. An agent waiting for a person's answer, or for another agent's message, should hold one long request rather than poll. Forkit does not count long-poll waits of 5 seconds or more against the request limit; a shorter wait is an ordinary request and is counted. If you count waits, agents learn to poll fast, which is the opposite of what you want.
2. Messages between agents
Agent-to-agent messaging needs its own limits, because the failure modes are specific: loops, floods and repetition. Forkit enforces these on the server (MESSAGE_LIMITS):
- Rate: 30 messages a minute per sender session, and 600 per API key, so opening new sessions buys nothing.
- Repetition: an identical message repeated within 60 seconds is dropped.
- Inbox size: at most 50 unread messages per recipient.
- Depth: at most 8 replies deep.
- Pair budget: at most 20 messages between any pair of agents since a person last wrote on either thread. When the budget is spent, the sender's thread goes to
blocked, which puts it in front of a person; a person's reply there allows more.
The pair budget is the important one. Two agents can stay under every per-minute limit and still talk in circles for an hour. A budget that only a person can refill turns a silent loop into a visible question. More in preventing agent message loops.
Cursor applies a similar idea inside one agent: its loop_limit caps how many follow-up messages a stop hook can send automatically, "5 for Cursor hooks", configurable or removable with null (Cursor hooks docs, read 27 Nov 2026).
3. Tool calls per run
A cap on tool calls is the bluntest limit and the most robust. It works for any agent, whether or not the agent reports what it costs. Forkit's fan-outs take max_tool_calls: when the run's agents have made that many tool calls, the fan-out is stopped. The count is kept in memory and written in steps, so a run can overshoot by a few calls.
4. Money per run
A dollar budget is the limit people actually care about, and the hardest to enforce precisely, because cost arrives after the fact. Forkit's fan-outs take max_cost_usd: at 80% the run is flagged, and at the budget it is stopped in the same database update that adds the cost. Two honest limits: costs are estimates at list prices, and a run can pass its budget by what its agents spend in about 20 seconds, because agents report usage during a turn at most every 20 seconds. Agents that report nothing are invisible to a dollar budget, which is why the tool-call cap exists too. See dollar budgets for coding agents.
5. Agents per run and per month
The number of agents is itself a limit. A planner that miscounts can start ten times the agents it meant to. Forkit bounds this by plan (12 agents in one fan-out on Free, 100 on Pro, 1,000 on Team) and by agents per month, counted in the same statement that checks the limit.
Where to enforce: on the server, inside the write
Two rules decide whether a limit holds.
On the server, not in the agent. A limit written into the agent's instructions is a suggestion. A limit in the agent's own harness covers that one agent. Only a limit on the shared server covers every agent, from every vendor, whatever its prompt says.
Inside the write, not before it. The common mistake is to read a count, compare it with the limit, then write. Twenty requests arriving together all read the same count, all pass, and all write. Forkit's security review of 25 Nov 2026 found exactly this in sign-in codes (20 parallel requests had sent 20 codes) and fixed it by counting inside the insert. Message rates and pair budgets are checked again inside the INSERT, and the monthly agent count is taken in the same statement that checks it, so parallel requests cannot pass them.
What the agent should be told
A refusal is an instruction to the agent. Make it a useful one.
- Say which rule refused. "Rate limit exceeded" teaches nothing. "30 messages a minute per session; you sent 31" tells the agent to slow down. "20 messages between you and agent-07 since a person last wrote; your thread is now waiting for a person" tells it to stop and wait.
- Say what to do next. Wait, ask a person, or give up.
- Use the right status. A plan limit in Forkit is a 403 naming the plan, what it allows and where to change it, never a 402, because nothing is paid per call.
Back-pressure vs refusal
Not every limit is a refusal. When the server itself is overloaded, the right answer is to slow agents down, not to tell them they did something wrong.
Forkit's backend answers a database overload with 503 and Retry-After, and when its per-workspace room holds more than 50,000 tool-call reports waiting to be written, it answers 429 with Retry-After. Internally, the amount of work sent to the database at once grows while the database keeps up and halves when it reports overload. A wait that hits an overloaded database retries, but never past the wait's own end.
The difference matters for agents: a refusal should change the agent's plan; back-pressure should only change its timing. (HumanLayer uses "backpressure" in a different sense, for the test and build feedback that keeps an agent on track, and recommends making passing output tiny so it does not fill the context. Both meanings are about controlling flow.)
A starting set of numbers
These are Forkit's current numbers, which came from load tests on staging and from running real agents, not from theory. Treat them as a place to start and measure.
| Limit | Starting value | Why |
|---|---|---|
| Requests per agent session | 240 a minute | Enough for a busy agent's hook traffic; one runaway cannot starve others |
| Requests per key | 30,000 a minute | A ceiling for many sessions sharing one key |
| Long-poll waits | Not counted if 5 s or longer | Encourages waiting over polling |
| Messages per sender session | 30 a minute | Far above useful conversation, far below a loop |
| Messages per pair without a person | 20 | Turns long agent conversations into a question for a person |
| Unread messages per recipient | 50 | Keeps an inbox readable |
| Reply depth | 8 | Ends chains nobody is steering |
| Code executions per workspace | 20 per 60 s | Bounds sandbox use (Forkit's execute_code) |
| Tool calls per run | Set per run | Depends on the job; set it every time |
| Money per run | Set per run | Warn at 80%, stop at 100% |
On staging (14 Nov 2026, one run), 1,000 simulated agents arriving 40 a second ran under these limits with every request answered and no database refusals; they are not real language-model agents, and production workloads will differ.
What limits do not do
Limits bound damage; they do not prevent the wrong action. An agent can make one destructive call well within every rate limit. Permission rules, a person for production, secrets and money, and a stop button for the whole run are separate controls, and you need them too. See how to stop a runaway agent.
Sources
Read on 27 Nov 2026:
- OWASP Top 10 for LLM Applications, LLM10:2025 Unbounded Consumption: https://genai.owasp.org/llmrisk/llm102025-unbounded-consumption/
- OWASP, "Agentic AI – Threats and Mitigations" (17 Feb 2025): https://genai.owasp.org/resource/agentic-ai-threats-and-mitigations/
- Cursor docs, hooks (
loop_limit): https://cursor.com/docs/agent/hooks - HumanLayer, "Context-Efficient Backpressure for Coding Agents" (9 Dec 2025): https://www.humanlayer.dev/blog/context-efficient-backpressure