python-resilience

Implement automated retry and timeout logic for external Python calls.

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/jacexh/skills --skill python-resilience-jacexh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-resilience
Source: https://github.com/jacexh/skills/tree/main/skills/python-resilience
Command: npx skills add https://github.com/jacexh/skills --skill python-resilience-jacexh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reduce outages and fragile behavior caused by transient network failures, intermittent service errors, and unbounded retry loops by providing clear patterns for retries, backoff, timeouts, and graceful degradation so production services remain responsive and observable.

Core Features & Use Cases

  • Retry patterns: Use tenacity-based decorators for exception- and result-driven retries with exponential backoff and jitter.
  • Timeouts and decorators: Provide reusable sync/async timeout decorators and composable infrastructure decorators for tracing, logging, and fail-safe defaults.
  • Testability and observability: Encourage dependency injection, structured logging, and metrics to make retry behavior visible and easy to test.
  • Use Case: Harden HTTP client calls to a third-party API with bounded retries, jittered backoff, retry-on-5xx/429 logic, and a fallback default for non-critical features.

Quick Start

Add retry with exponential backoff, jitter, and a 30 second overall timeout to the function that performs HTTP requests and log each retry attempt.

Frequently Asked Questions about python-resilience

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

FAQPage Schema
How do I add retry logic with exponential backoff and jitter to Python HTTP client calls?

Retry logic with exponential backoff and jitter for Python HTTP calls is implemented using tenacity-based decorators that handle transient network failures and rate limits. Bounded retries prevent unbounded loops, keeping production services responsive.

What is the best way to handle transient network failures and rate limits in Python microservices?

Transient network failures and rate limits in Python microservices are handled through automated retry patterns with exponential backoff, jitter, and timeout decorators. Retry-on-5xx and retry-on-429 logic targets intermittent service errors specifically.

How do I set up timeout decorators for unreliable external Python calls?

Timeout decorators for unreliable external Python calls are provided as reusable sync and async decorators. An overall timeout, such as a 30-second limit, bounds execution time and prevents unresponsive services from hanging indefinitely.

Does this retry and timeout approach work with both synchronous and async Python functions?

Both synchronous and async Python functions are supported with reusable timeout and retry decorators. Composable decorators for logging, tracing, and fail-safe defaults integrate into existing networked Python applications and microservice interactions.

Can I provide a fallback default for non-critical features when Python HTTP retries are exhausted?

A fallback default for non-critical features is provided when bounded retries are exhausted. Fail-safe defaults allow HTTP client calls to degrade gracefully during transient failures, maintaining service responsiveness instead of throwing exceptions.

Why do I need bounded retries and jitter in Python fault-tolerance patterns?

Bounded retries and jitter are needed in Python fault-tolerance patterns to prevent unbounded retry loops and thundering herd problems. Jitter randomizes backoff intervals, distributing retry load and avoiding compounding transient failures across microservices.