Pacing autonomous workers so they stop hitting the wall

AnthropicAPIFreeKey · Updated 2026-11-22 · 9 min read

Traffic light metering cars onto a highway
Pacing requests keeps an agent moving instead of stalling.

A small business sets up a dedicated machine to run an always-on AI agent as a project coordinator. It works well for a few days, then hits a hard wall: the API starts refusing requests because the agent is sending them faster than the account allows. Elsewhere, a developer runs several coding agents in parallel and finds them fighting over the same shared resource, and another keeps getting a 400 error on one specific kind of request for weeks.

These are different symptoms of one design question: how should software that calls a model on its own, without a human pacing it, behave when the API pushes back? This article covers the types of limits hosted APIs apply, how to read the most common error responses, how to pace and queue parallel work, and how to prototype all of it on a free endpoint with strict, published limits before pointing the agent at a paid account.

Frequently asked questions

What is an API rate limit?

A cap on how fast a client may use an API, typically requests per minute and tokens per minute, sometimes also concurrent requests. It protects shared capacity. Exceeding it returns an error, usually HTTP 429, rather than queueing your request.

How do Anthropic's API rate limits work in general?

Anthropic applies limits per organisation that depend on a usage tier, and tiers generally rise as an account builds payment history. The exact numbers change over time, so check the rate limits page in Anthropic's current documentation rather than relying on figures from forum posts.

How does a 429 differ from a 503?

A 429 means you are sending too much and should slow down; it often includes a Retry-After header. A 503 means the server is busy or unavailable regardless of your own rate; waiting a few seconds and retrying is appropriate.

What does a 400 error usually mean for an agent?

The request itself is invalid: a malformed parameter, an unsupported option, a message structure the API does not accept, or input that is too large. Retrying will not fix it. Log the full request body and compare it with the API documentation.

Why do parallel agents conflict with each other?

Because they share something: an API quota, a browser session, a working directory, a database row. Without coordination, each agent assumes it owns the resource. Give each one its own resource or put a lock or queue in front of the shared one.

Does a higher monthly plan raise API limits?

Consumer chat subscriptions and API usage are typically billed and limited separately. Paying for a chat plan does not necessarily change your API rate limits. Check the provider's own documentation for how each is measured.

What are the limits on this site's free endpoint?

Per IP: 1 request per second with bursts of 3, 2 requests in parallel, and 10,000 requests or 10,000,000 tokens per day, reset at 00:00 UTC. A 429 includes Retry-After; a 503 means busy, so retry after 2 to 5 seconds.

Which is better for an always-on agent, a free endpoint or a paid key?

For anything business-critical, a paid key with known limits, an SLA where available and published data terms. The free endpoint suits development, testing and low-volume personal agents, with the understanding that it has no SLA and its model, free-ai, is weaker than Claude.

Why agents hit limits that humans never do

A person typing into a chat window is naturally rate-limited by reading and thinking. An agent is not. It can read a file, call the model, run a command, call the model again and spawn a sub-task in the time a human reads one paragraph. Each of those steps is a request, and many of them carry a large context. Limits designed around human pacing are reached quickly.

Always-on agents add a second effect: they never stop. A coordinator agent that polls a task board, summarises messages and drafts updates every few minutes generates steady background load around the clock. Even modest per-minute traffic adds up to a large daily total, and any loop that misbehaves turns into a storm of requests within seconds.

Hidden fan-out

One instruction to an agent can trigger a dozen model calls. When planning capacity, count calls per task, not tasks per hour.

Runaway loops

An agent that retries a failing step immediately and forever can exhaust a daily quota in minutes. Every loop needs a maximum number of attempts.

The kinds of limits you will meet

Hosted APIs usually combine several limits, and an agent can hit any of them. Knowing which one triggered tells you what to change.

Requests per unit of time

The simplest limit: how many calls per second or minute. Short, frequent calls hit this first. Batching small questions into one request helps.

Tokens per unit of time

Large contexts hit this one even at low request rates. An agent that resends a big repository snapshot each turn can be throttled while making only a few calls.

Concurrency

Some APIs cap how many requests may be in flight at once. Parallel workers beyond that number simply get errors.

Daily or monthly budgets

Spend limits and daily allowances stop traffic entirely until reset. These need monitoring, because no amount of pacing within the day avoids them.

Pipes with valves of different sizes on a brick wall
Requests, tokens, concurrency and budgets are separate limits.

Reading error responses correctly

Agents should treat HTTP status codes as instructions. A 429 says slow down and often tells you exactly how long to wait. A 503 or similar overload response says the service is struggling; back off and try again shortly. A 400 says the request is wrong; stop and report. A 401 or 403 says the credentials or permissions are wrong; stop and alert a human.

The persistent 400 case deserves attention because it is common with agents. When a tool or feature consistently fails with an invalid-argument error, the cause is usually a request shape the API does not accept for that model or feature: an unsupported parameter, a content type the model cannot handle, or an output exceeding a limit. The workaround people often find, such as switching models or reducing a setting, is a clue to which parameter is at fault.

  • 429: wait for Retry-After, then reduce your request rate
  • 503 or overloaded: retry after a few seconds with backoff
  • 400: log the request body, fix the request, do not retry
  • 401 or 403: stop the agent and alert a person
  • Timeouts: retry once, then treat like a server error

Pacing requests with a limiter

The robust fix is to pace requests on the client side so the server rarely needs to refuse them. Two tools cover most cases: a semaphore that caps how many requests run in parallel, and a rate limiter that spaces out request starts. Together they keep an agent within limits even when many tasks are queued.

The example below runs a list of tasks through the free endpoint with at most 2 requests in flight and roughly one new request per second, matching its published per-IP limits. Change the two numbers to match whatever limits your paid account has.

One limiter per account

If several processes share an API key or an IP, they must share the limiter too, for example through a small queue service or a shared cache. Separate limiters per process will overshoot.

import asyncio, time
from openai import AsyncOpenAI, RateLimitError

client = AsyncOpenAI(base_url='https://api.anthropicapifreekey.com/v1', api_key='unused')
PARALLEL = 2          # max requests in flight
INTERVAL = 1.0        # seconds between request starts

sem = asyncio.Semaphore(PARALLEL)
lock = asyncio.Lock()
last_start = 0.0

async def paced_start():
    global last_start
    async with lock:
        wait = last_start + INTERVAL - time.monotonic()
        if wait > 0:
            await asyncio.sleep(wait)
        last_start = time.monotonic()

async def ask(prompt: str) -> str:
    async with sem:
        for attempt in range(4):
            await paced_start()
            try:
                r = await client.chat.completions.create(
                    model='free-ai', max_tokens=300,
                    messages=[{'role': 'user', 'content': prompt}])
                return r.choices[0].message.content
            except RateLimitError as e:
                await asyncio.sleep(float(e.response.headers.get('retry-after', 2)))
        return 'gave up after retries'

async def main():
    tasks = [f'Give one tip for organising project task #{i}.' for i in range(6)]
    for answer in await asyncio.gather(*(ask(t) for t in tasks)):
        print('-', answer.strip()[:120])

asyncio.run(main())
Station turnstile with a short orderly queue
A semaphore and a rate limiter work like a turnstile.

Coordinating parallel agents

Running several agents in parallel multiplies throughput and multiplies conflicts. Developers who run multiple coding agent instances that each control the same browser report exactly this: the instances fight over the same tabs and undo each other's actions. The model is not the problem; the shared resource is.

The general rule is to give each agent its own copy of anything stateful, or to put a single coordinator in front of a shared resource. Separate browser profiles, separate working directories or branches, separate temporary folders and a central queue for API calls solve most conflicts.

Isolate state

One working directory, one browser profile and one scratch space per agent. Shared state is where parallel agents break each other's work.

Centralise scarce resources

If agents must share a quota or a single external account, route their requests through one queue that enforces order and pacing.

Reducing load instead of buying headroom

Before upgrading to a higher tier, check how much of the load is necessary. Agents often poll when they could wait for an event, resend full context when a summary would do, and ask the model to make decisions that ordinary code could make. Each of these is a cheap fix with a large effect on both rate limits and cost.

Caching helps too. If an agent asks the same question about the same file repeatedly, store the answer keyed by the file's hash. If it classifies similar messages, cache by normalised input. Anything that avoids a model call is faster than the fastest model.

  • Replace polling with webhooks or scheduled batches
  • Summarise context instead of resending it in full
  • Let plain code handle deterministic decisions
  • Cache answers for repeated inputs
  • Use a smaller model for routing and classification
Two robot vacuums colliding in a doorway
Parallel agents need their own state or a coordinator.

Prototyping an agent on strict limits

Developing an agent against an endpoint with tight, published limits is a useful discipline. If your design works at 1 request per second and 2 in parallel, it will behave politely on any paid tier, and you will have tested your retry and pacing logic for real rather than in theory. This site's endpoint offers exactly that, with no key and no account.

Keep its nature in mind. The service is independent and not affiliated with Anthropic, and the model, free-ai, is an open-weight model of about 35B parameters, not Claude. Smaller models mis-call tools and lose track of long plans more often, so validate any structured output the agent produces before acting on it. For how to switch the backend later without rewriting the agent, see the guide to custom endpoints in Open WebUI, which uses the same configuration idea.

Validate before acting

Parse and check every tool call or JSON action the model returns. Reject and re-ask on invalid output rather than executing something half-formed.

Moving the agent to production limits

When the agent graduates to a paid key, revisit three numbers: requests per minute, tokens per minute and concurrency for your tier, all from the provider's current documentation. Set your client-side limiter slightly below them. Add a spend limit and an alert on the account, and log every 429 with a timestamp so you can see whether you are regularly near the ceiling.

If you are hitting limits constantly despite pacing, that is a capacity signal rather than a bug. Options include requesting a higher tier through official channels, spreading non-urgent work over the day, or routing low-stakes calls to a cheaper backend. The outage-handling patterns in the fallback guide combine naturally with this, and the cost side is covered in the cost estimation guide.

Log every refusal

A daily count of 429 responses per feature tells you where pacing is too aggressive and where you genuinely need more capacity.

Keep a kill switch

An always-on agent should have a simple way to pause it. When something goes wrong at night, stopping the loop is the first step.

Red emergency stop button on a machine
Every always-on agent deserves a kill switch.
Try the free API

Send a prototype prompt from the chat box on the home page: no key, no account and no card needed, just the usual per-IP limits.

Read also