python-resilience

Implement retries, exponential backoff, jitter, and timeouts in Python.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/sadroad/.dotfiles --skill python-resilience-sadroad
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-resilience
Source: https://github.com/sadroad/.dotfiles/tree/main/modules/home-manager/opencode/skills/python-resilience
Command: npx skills add https://github.com/sadroad/.dotfiles --skill python-resilience-sadroad

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tenacity, httpx, asyncio, structlog, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers build more reliable and fault-tolerant Python applications by implementing patterns to handle transient failures, network issues, and service outages gracefully.

Core Features & Use Cases

  • Automatic Retries: Implement retry logic for external service calls that may fail temporarily.
  • Exponential Backoff & Jitter: Prevent overwhelming services during recovery and avoid thundering herd issues.
  • Timeouts: Ensure operations don't hang indefinitely, improving application responsiveness.
  • Fault-Tolerant Decorators: Create reusable components for handling errors and retries.
  • Use Case: When making an API call that might occasionally fail due to network glitches or temporary service unavailability, use this Skill to automatically retry the call with increasing delays until it succeeds or a maximum attempt limit is reached.

Quick Start

Use the python-resilience skill to define a function that retries up to 3 times with exponential backoff when calling an external service.

Frequently Asked Questions about python-resilience

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement retry logic with exponential backoff in Python?

Retry logic with exponential backoff in Python is implemented using reusable decorators that automatically retry failed operations with increasing delays. This Skill provides patterns to add exponential backoff and jitter to prevent overwhelming services during recovery from transient failures.

What is the best way to handle transient failures and network errors in Python applications?

Handling transient failures and network errors in Python applications is achieved through fault-tolerant patterns like automatic retries, timeouts, and exponential backoff. These patterns ensure operations fail gracefully instead of hanging indefinitely or crashing the application.

Can I use asyncio and httpx to build fault-tolerant services with this approach?

Yes, building fault-tolerant services with asyncio and httpx is supported through resilience decorators. These components handle external dependency issues by wrapping asynchronous network calls with retry mechanisms and timeouts to manage service unreliability.

How do you add jitter to retry logic to avoid thundering herd issues?

Adding jitter to retry logic randomizes delay times between retry attempts, which prevents thundering herd issues when multiple clients simultaneously retry failed calls. This Skill provides decorator patterns that combine exponential backoff with jitter for safe service recovery.

When do I need timeouts in Python fault tolerance patterns?

Timeouts in Python fault tolerance patterns are needed when external service calls or network operations risk hanging indefinitely. Implementing timeouts ensures operations fail fast and improves application responsiveness when dealing with unreliable external dependencies.