- Home
- Skills
- APIs & Backend
- tenacity async retry converter
tenacity async retry converter
Audits and converts blocking or hand-rolled Python retry logic into event-loop-friendly Tenacity async patterns.
$10
Works with the AI Agents you already use
tenacity async retry converter
Example session with this skill installed
Analyze the retries in ./services/downloader.py. The event loop seems to be lagging whenever the external API times out. Check if the retries are blocking.
- Read your context and instructions
- Compiled the tenacity async retry
I have completed the audit of ./services/downloader.py. I found 2 high-severity issues where synchronous sleep calls and blocking network requests were stalling the event loop during retry backoffs.
Tenacity Async Retry Audit
| Finding ID | Severity | Location | Issue |
|---|---|---|---|
| ASY-1-8a2f | Critical | downloader.py:42 | time.sleep used inside async retry blocks the event loop. |
| ASY-2-4c1d | High | downloader.py:58 | Sync requests.get blocks loop; should use httpx.AsyncClient. |
Detail: ASY-1-8a2f
The current implementation uses time.sleep(2) within a retry loop. In an asynchronous context, this stops all other concurrent tasks from executing. I have generated a patch to use tenacity.wait_exponential which correctly yields control back to the loop.
# Patch for downloader.py:42
from tenacity import AsyncRetrying, stop_after_attempt, wait_fixed
async def download_resource(url):
async for attempt in AsyncRetrying(
stop=stop_after_attempt(5),
wait=wait_fixed(2),
reraise=True
):
with attempt:
# logic here
pass
Next steps
- Review the full report in
./output/tenacity-async-retry-converter-report.md. - Apply the validated patches from
./output/patches/. - Verify that
httpxis installed for the recommended async network replacements.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
Improper retry logic in asynchronous Python code often blocks the event loop, causing latency spikes or complete service stalls. Hand-rolled retry loops frequently mishandle asyncio.CancelledError, leading to tasks that cannot be stopped.
What it does
- Identifies blocking calls like
time.sleeporrequestsinside retried async functions. - Converts manual
while/try/exceptloops into properAsyncRetryingcontexts. - Audits exception filters to ensure cancellation signals are not swallowed by accident.
- Detects unbounded fan-out where
asyncio.gatherand retries combine to overwhelm downstream services. - Generates syntax-validated patches using
tenacitybest practices.
Frameworks & tools
Built for Python asyncio environments utilizing tenacity, httpx, aiohttp, and trio/anyio.
Why this beats prompting it yourself
Generic LLMs often provide synchronous retry snippets that will freeze your async loop. This skill uses a systematic audit of six specific async-failure patterns and validates every generated patch against the Python AST to ensure zero syntax errors.
Use cases
- Refactoring legacy blocking retry loops during an
httpxmigration. - Fixing "zombie" tasks that refuse to cancel due to
BaseExceptionretry filters. - Stabilizing microservices that experience event loop lag under high load.
Known limitations
Does not modify source files directly, requires manual application of generated patches. Ignores non-UTF-8 files and Python versions 2.x.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Read-only analysis; patches must be applied manually. Caps at 10 findings per run. Does not support Python 2.x or non-UTF-8 files. Analysis limited to 5,000 files per run.
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