- Home
- Skills
- Agents & Orchestration
- tenacity retry storm auditor
tenacity retry storm auditor
Detects and fixes nested retry loops and request amplification in Python call chains.
$10
Works with the AI Agents you already use
tenacity retry storm auditor
Example session with this skill installed
Audit the ./services/payment-processor directory for nested retries and compute the worst-case request multiplier. We are seeing high 429 rates on our upstream gateway.
- Read your context and instructions
- Compiled the tenacity retry storm
I have audited the ./services/payment-processor directory. I identified 3 instances of retry amplification where nested decorators and library defaults were creating up to 27x request spikes per user action.
Tenacity Retry Storm Audit
| ID | Severity | Location | Issue |
|---|---|---|---|
| STM-1-A | Critical | clients/gateway.py:42 | 27x Amplification: Handler(3) -> Service(3) -> SDK(3) |
| STM-3-B | High | adapters/stripe.py:112 | Ignores Retry-After on 429 responses |
| STM-2-C | Medium | tasks/reconcile.py:15 | No stop_after_delay bound on background task |
Amplification Analysis: Payment Flow
- Layer 1:
@task(bind=True, max_retries=3)intasks/process.py - Layer 2:
@retry(stop=stop_after_attempt(3))inlogic/billing.py - Layer 3:
urllib3.Retry(total=3)inclients/http.py - Worst-case Multiplier: 27x attempts
- Result: One failure triggers 27 calls, likely causing the 429s you are seeing.
Recommended Fix (Patched in ./output/patches/STM-1-A.py)
from tenacity import retry, stop_after_attempt, stop_after_delay, wait_exponential_jitter
def wait_retry_after(fallback, cap: float = 60.0):
def _wait(retry_state):
exc = retry_state.outcome.exception() if retry_state.outcome else None
resp = getattr(exc, "response", None)
header = resp.headers.get("Retry-After") if resp is not None else None
if header and header.strip().isdigit():
return min(float(header), cap)
return fallback(retry_state)
return _wait
# Flattened: Single retry at the idempotent boundary
@retry(
stop=stop_after_attempt(4) | stop_after_delay(30),
wait=wait_retry_after(wait_exponential_jitter(initial=1, max=10)),
reraise=True,
)
def unified_payment_call():
# Inner layers now set to 0 retries / 1 attempt
return stripe_client.execute(retries=0)
Next steps
- Review the detailed amplification table in
./output/tenacity-retry-storm-auditor-report.md. - Apply the flattened retry patch to
clients/gateway.pyto reduce gateway load. - Update environment variables to set the new 30s global deadline.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Nested retry logic in microservices and distributed tasks often creates exponential request amplification. Without coordination, a minor downstream delay can trigger a retry storm that self-inflicts a denial-of-service attack on your own infrastructure.
What it does
- Identifies recursive and stacked retries across call chains, including library-level retries like Boto3 and urllib3.
- Calculates the worst-case attempt multiplier and total duration for complex execution paths.
- Detects missing
Retry-Afterheader handling and lack ofstop_after_delaybounds. - Generates flattened retry designs that move persistence to the outermost idempotent boundary.
- Drafts dependency-free circuit breaker implementations for identified high-risk dependencies.
Frameworks & tools
Python, Tenacity, Celery, RQ, Boto3, and standard HTTP client libraries.
Why this beats prompting it yourself
Manual audits often miss implicit retries inside SDKs or cross-file imports. This skill systematically builds the call graph to multiply attempt counts across layers, catching amplification risks that look safe in isolation but fail at scale.
Use cases
- Auditing a service before a high-traffic launch to prevent cascading failures.
- Refactoring legacy Celery tasks where retries are defined in both the task and the internal logic.
- Hardening API clients to respect rate limits and downstream 429/503 responses.
- Analyzing infrastructure costs driven by excessive, unsuccessful request attempts.
Known limitations
Only analyzes Python source code. Cross-service amplification is estimated based on visible repository code and assumed 1x hops for external calls.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.
Python only. Limited to static analysis of local source code. Cannot trace call chains into compiled binaries or external repositories. Cross-service calls are treated as single hops.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 months ago
- Software
Python
Permissions
No special permissions declared or detected