tenacity backoff tuner

    1

    Audit Python tenacity retry logic to fix thundering herds, unbounded waits, and latency budget overruns.

    $10

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    tenacity backoff tuner

    Example session with this skill installed

    Audit the tenacity retry settings in ./services/payment_processor and suggest fixes for any unbounded backoffs or missing jitter.

    • Read your context and instructions
    • Compiled the tenacity backoff tuner

    Analyzed 14 files in ./services/payment_processor. Found 2 high-severity findings related to unbounded exponential backoff and synchronized retry intervals.

    Tenacity Backoff Audit Report

    Finding IDSeverityLocationIssue
    BKO-2-a8f2Highclient.py:42wait_exponential missing max value (unbounded)
    BKO-4-c9d1Mediumdb_sync.py:112wait_fixed(2) used by concurrent workers (thundering herd)

    Recommended Fixes

    Finding BKO-2-a8f2: Unbounded Wait

    Problem: The current configuration allows the wait time to grow indefinitely, which will eventually hang the worker process.
    Fix: Cap the exponential wait and add a total delay stop condition.

    
    # Before
    @retry(wait=wait_exponential(multiplier=1))
    
    # After (Worst case: ~31s total across 6 attempts)
    @retry(
        stop=stop_after_attempt(6) | stop_after_delay(60),
        wait=wait_exponential_jitter(initial=1, max=10),
        reraise=True
    )
    
    Finding BKO-4-c9d1: Missing Jitter

    Problem: Fixed 2-second intervals cause all instances to hit the database simultaneously after a failure.
    Fix: Introduce jittered backoff.

    
    # Before
    @retry(wait=wait_fixed(2))
    
    # After (Prevents synchronization)
    @retry(
        stop=stop_after_attempt(5),
        wait=wait_random_exponential(multiplier=1, max=10),
        reraise=True
    )
    

    Next steps

    1. Review the generated patches in ./output/patches/.
    2. Apply BKO-2-a8f2.py to client.py to prevent worker hangs.
    3. Verify the new 31s worst-case latency fits within the payment_processor upstream timeout.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    Improperly configured retries lead to thundering herd outages, unbounded memory growth, and silent timeouts. Most developers use default backoff settings that lack jitter or fail to account for the total latency budget of the caller.

    What it does

    • Scans Python source code to detect risky tenacity configurations like fixed waits, missing jitter, or infinite retry loops.
    • Computes worst-case timing math for exponential backoff chains to ensure they fit within your request SLAs.
    • Identifies unit mistakes, such as using milliseconds in a library that expects seconds.
    • Generates paste-ready Python patches with optimized wait and stop parameters for every finding.

    Frameworks & tools

    Python, Tenacity.

    Why this beats prompting it yourself

    Manually calculating the cumulative sum of exponential waits with jitter is error-prone and tedious. This tool automates the math, enforces fleet-wide safety patterns, and provides a structured audit trail of every retry point in your codebase.

    Use cases

    • Hardening microservices against cascading failures by adding jitter to API clients.
    • Auditing legacy worker scripts to prevent infinite, resource-draining retries.
    • Tuning background job backoff to meet specific business-logic latency targets.

    Known limitations

    Does not support non-UTF-8 files or Python 2. Analysis is read-only and does not handle dynamic retry configurations defined at runtime outside of static analysis reach.

    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.

    Does not support Python 2 or non-UTF-8 files. Analysis is static; dynamic configurations resolved at runtime may be marked as dynamic rather than fully resolved.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Listed2 months ago
    Updated1 month ago

    What's inside

    Frequently Asked Questions

    This skill specifically targets the Python 'tenacity' library, analyzing your code to identify risky retry logic—like missing jitter or infinite loops—and provides mathematically sound patches to prevent 'thundering herd' outages.

    The skill performs a static analysis of your source code to calculate worst-case timing for exponential backoff chains, ensuring your retry logic aligns with your actual request SLAs and latency budgets.

    This skill is designed for AI agents with file-system access or code-review capabilities; simply provide the agent with your Python source files or a directory path to begin the audit.

    You receive the full skill logic for auditing tenacity configurations, including the proprietary math engines for backoff calculation and the templates for generating optimized Python patches.

    Yes, the tuner identifies common unit errors, such as accidentally passing milliseconds to parameters that tenacity expects in seconds, which is a frequent cause of silent timeouts.

    The skill is designed for static Python code analysis; it does not support Python 2 or dynamic retry configurations where parameters are determined at runtime via external databases or variables.

    New in APIs & Backend