- 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 tools 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
- Generated the document
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.
tenacity-async-retry-converter.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
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.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 14 days ago
- Passed all security checks, Safe to install