# Rate limits

Turn on the Claude API's request limits, so a call past its allowance gets a 429 rate_limit_error with retry-after.

Test that your client paces itself on the Claude API's limit headers and backs off from a 429 before it retries. The Managed Agents reads share one allowance of 1,200 a minute, counted in `anthropic-ratelimit-requests-*` headers. With no setting nothing is refused, so 1,203 reads of the agents list in a row all succeed:

```bash
A=(-H 'x-api-key: sk-ant-placeholder' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: managed-agents-2026-04-01')
agents="$RYSTIC_URL/v1/agents?beta=true"
curl -s -D - -o /dev/null "${A[@]}" "$agents" | tr -d '\r' | grep -i '^anthropic-ratelimit-requests-\(limit\|remaining\)'
# -> anthropic-ratelimit-requests-limit: 1200
# -> anthropic-ratelimit-requests-remaining: 1199
curl -s "${A[@]}" -w '%{http_code}\n' $(for i in $(seq 1203); do echo "-o /dev/null $agents"; done) | sort | uniq -c | awk '{print $2, $1}'
# -> 200 1203
```

[`rate_limits: real`](https://www.rystic.ai/docs/network-profiles.md) applies every limit that [Rate limits](https://www.rystic.ai/docs/simulators/anthropic.md#rate-limits) lists. The Managed Agents read allowance is a one-minute window that opens on the whole second of its first read. Below, the limits go on and a reset refills every allowance. Then one connection sends 1,203 agents reads, and a sessions read draws on the same allowance:

```bash
A=(-H 'x-api-key: sk-ant-placeholder' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: managed-agents-2026-04-01')
agents="$RYSTIC_URL/v1/agents?beta=true"
curl -s -X POST "$RYSTIC_URL/_rystic/network" -o /dev/null -w '%{http_code}\n' -d '{"rate_limits": "real"}'
# -> 204
curl -s -X POST "$RYSTIC_URL/_rystic/reset" -o /dev/null -w '%{http_code}\n'
# -> 204
curl -s "${A[@]}" -w '%{http_code}\n' $(for i in $(seq 1203); do echo "-o /dev/null $agents"; done) | sort | uniq -c | awk '{print $2, $1}'
# -> 200 1200
# -> 429 3
curl -s "${A[@]}" "$RYSTIC_URL/v1/sessions?beta=true" | jq -c '{type, error: .error.type}'
# -> {"type":"error","error":"rate_limit_error"}
curl -s -D - -o /dev/null "${A[@]}" "$agents" | tr -d '\r' | awk -F': ' 'tolower($1) == "retry-after" && $2 >= 1 && $2 <= 60 {print "retry-after within a minute"}'
# -> retry-after within a minute
reset=$(curl -s -D - -o /dev/null "${A[@]}" "$agents" | tr -d '\r' | awk -F': ' 'tolower($1) == "anthropic-ratelimit-requests-reset" {print $2}')
jq -rn --arg r "$reset" '($r | fromdateiso8601) - now | if . > 0 and . <= 60 then "resets within a minute" else . end'
# -> resets within a minute
curl -s -o /dev/null -w '%{http_code}\n' "${A[@]}" "$RYSTIC_URL/v1/environments?beta=true"
# -> 200
```

The refused reads got the Claude API's error envelope with `rate_limit_error`, and `retry-after` gives the seconds until the window ends. `anthropic-ratelimit-requests-reset` is that end as an RFC 3339 time. The environments read succeeded because environment reads are outside the Managed Agents read allowance, as the API's own headers show. The 429's `message` is the simulator's own wording, and its `request_id` is the same on every refusal (unconfirmed).

Messages draw on their own allowance of 10,000 a minute. It refills a little at a time, so after one message its reset is the current second, the moment it is full again. Tokens a minute are not counted, so a message includes no token headers. A reset of the simulator keeps `rate_limits` set to `real` and gives every allowance back:

```bash
A=(-H 'x-api-key: sk-ant-placeholder' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: managed-agents-2026-04-01')
msg=$(curl -s -D - -o /dev/null "${A[@]}" -H 'content-type: application/json' "$RYSTIC_URL/v1/messages" -d '{"model": "claude-haiku-4-5-20251001", "max_tokens": 16, "messages": [{"role": "user", "content": "Hi"}]}' | tr -d '\r')
echo "$msg" | grep -i '^anthropic-ratelimit-requests-\(limit\|remaining\)'
# -> anthropic-ratelimit-requests-limit: 10000
# -> anthropic-ratelimit-requests-remaining: 9999
reset=$(echo "$msg" | awk -F': ' 'tolower($1) == "anthropic-ratelimit-requests-reset" {print $2}')
jq -rn --arg r "$reset" '(now | floor) - ($r | fromdateiso8601) | if . >= -1 and . <= 1 then "full again within a second" else . end'
# -> full again within a second
echo "$msg" | awk 'tolower($0) ~ /^anthropic-ratelimit-(input-|output-)?tokens-/ {n++} END {print n + 0, "token headers"}'
# -> 0 token headers
curl -s -X POST "$RYSTIC_URL/_rystic/reset" -o /dev/null -w '%{http_code}\n'
# -> 204
curl -s "$RYSTIC_URL/_rystic/network" | jq -r .rate_limits
# -> real
curl -s -D - -o /dev/null "${A[@]}" "$RYSTIC_URL/v1/agents?beta=true" | tr -d '\r' | grep -i '^anthropic-ratelimit-requests-remaining'
# -> anthropic-ratelimit-requests-remaining: 1199
```

Token counting, the file list, the batch list and memory store reads include no limit headers:

```bash
A=(-H 'x-api-key: sk-ant-placeholder' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: managed-agents-2026-04-01')
for route in /v1/files /v1/messages/batches '/v1/memory_stores?beta=true'; do curl -s -D - -o /dev/null "${A[@]}" "$RYSTIC_URL$route" | tr -d '\r' | awk -v p="$route" 'tolower($0) ~ /^anthropic-ratelimit-/ {n++} END {print p, n + 0}'; done
# -> /v1/files 0
# -> /v1/messages/batches 0
# -> /v1/memory_stores?beta=true 0
curl -s -D - -o /dev/null "${A[@]}" -H 'content-type: application/json' "$RYSTIC_URL/v1/messages/count_tokens" -d '{"model": "claude-haiku-4-5-20251001", "messages": [{"role": "user", "content": "Hi"}]}' | tr -d '\r' | awk 'tolower($0) ~ /^anthropic-ratelimit-/ {n++} END {print n + 0}'
# -> 0
```

The API also includes none on the first three. Memory store reads differ: the API includes its own limit headers there.

---

Source: https://www.rystic.ai/docs/simulators/anthropic/features/rate-limits · Markdown: https://www.rystic.ai/docs/simulators/anthropic/features/rate-limits.md
