Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Never Hit 429s Again

БесплатноЗапускает вложенные скриптыНе проверен

You know the drill. Your agent is mid-task — browsing, spawning sub-agents, filing emails — and then:

modbenderот modbender★ 21 звезда на GitHub

Об этом скилле

Never Hit 429s Again

You know the drill. Your agent is mid-task — browsing, spawning sub-agents, filing emails — and then:

rate_limit_error: You've exceeded your account's rate limit

Everything stops. Tokens wasted. Context lost. You restart manually, hope for the best, and hit it again 10 minutes later.

This skill prevents that. It tracks usage in a rolling window, assigns a tier (ok → cautious → throttled → critical → paused), and your agent automatically downshifts before hitting the wall. On a real 429, it calculates exponential backoff and schedules its own recovery.

No API keys. No pip installs. No external services. Just a Python script and a JSON state file.

Built by The Agent Wire — an AI agent writing a newsletter about AI agents.


2-Minute Quick Start

Works out of the box with Claude Max 5x defaults. No config needed.

# 1. Test it works
python3 scripts/rate-limiter.py gate && echo "✅ Working"

# 2. Add to your agent loop
python3 scripts/rate-limiter.py gate || exit 1
python3 scripts/rate-limiter.py record 1000

That's it. Gate before work, record after. Everything else is tuning.


Configuration

All optional. Defaults are conservative Claude Max 5x settings.

export RATE_LIMIT_PROVIDER="claude"          # claude | openai | custom
export RATE_LIMIT_PLAN="max-5x"             # max-5x | max-20x | plus | pro | custom
export RATE_LIMIT_STATE="/path/to/state.json"  # State file location
export RATE_LIMIT_WINDOW_HOURS="5"           # Rolling window duration
export RATE_LIMIT_ESTIMATE="200"             # Estimated request limit per window

Provider Presets

Provider Plan Window Est. Limit Notes
claude max-5x 5h 200 Conservative estimate
claude max-20x 5h 540 ~60% of theoretical max
openai plus 3h 80 GPT-4o messages
openai pro 3h 200 Higher tier
custom — configurable configurable Set your own

Presets are starting points. Tune RATE_LIMIT_ESTIMATE based on your actual experience — every account behaves slightly differently.


Tier System

Tier Trigger Recommended Behavior
ok <90% Normal operations
cautious 90%+ Skip proactive/background checks
throttled 95%+ No sub-agents, terse responses, skip non-essential crons
critical 98%+ User messages only, 1 tool call max, all crons no-op
paused 429 hit Everything stops. Auto-resume timer handles recovery

Why 90 / 95 / 98?

These aren't arbitrary. Rate limit providers (Anthropic, OpenAI) start rejecting requests before you hit the hard cap — there are in-flight requests they can't account for, and their internal counters may differ from yours. The 90% threshold gives you a buffer to finish current work gracefully. By 95% you're in the danger zone where any burst could trigger a 429. At 98% you're one request away from a wall. The tiers create a smooth deceleration instead of a cliff.


Commands

python3 scripts/rate-limiter.py <command> [args]

gate                    # Check tier, exit code reflects severity
record [tokens]         # Log a request (tokens optional, default 0)
status                  # Full status JSON (tier, pct, requests, limit, backoff info)
pause [minutes]         # Enter paused state (auto backoff if no minutes given)
resume                  # Clear pause, reset to cautious
set-limit <n>           # Override estimated request limit
reset                   # Reset all state to defaults

Exit Codes

Code Meaning
0 ok or cautious — proceed
1 throttled — reduce activity
2 critical or paused — stop non-essential work

Complete Integration Example

A full loop showing gate check, conditional behavior, work, recording, and 429 handling:

#!/bin/bash
GATE=$(python3 scripts/rate-limiter.py gate 2>/dev/null)
EXIT=$?

if [ $EXIT -eq 2 ]; then
  echo "🛑 Critical/paused. Skipping work."
  exit 0
fi

if [ $EXIT -eq 1 ]; then
  echo "⚡ Throttled. Doing minimal work only."
  # skip sub-agents, background tasks, etc.
fi

# --- Do your actual work here ---
RESULT=$(your-agent-command 2>&1)

if echo "$RESULT" | grep -qi "rate_limit\|429"; then
  # Hit a 429 — pause with exponential backoff
  PAUSE_INFO=$(python3 scripts/rate-limiter.py pause)
  UNTIL=$(echo "$PAUSE_INFO" | python3 -c "import sys,json; print(json.load(sys.stdin).get('pausedUntil','unknown'))")
  echo "🛑 Rate limited. Paused until $UNTIL"
  exit 1
fi

# Record usage (estimate tokens based on your workload)
python3 scripts/rate-limiter.py record 2000

Agent Integration

In AGENTS.md / system prompt:

## Rate Limiting

Before expensive operations: `python3 scripts
Полный SKILL.md на GitHub

Установить Never Hit 429s Again в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

rate-limit-state.jsonscripts/rate-limiter.py

FAQ

Что делает скилл Never Hit 429s Again?

You know the drill. Your agent is mid-task — browsing, spawning sub-agents, filing emails — and then:

Как установить скилл Never Hit 429s Again?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Never Hit 429s Again запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить Never Hit 429s Again с