
Python Resilience
Built around the tenacity library, this gives you production-ready retry patterns with exponential backoff, jitter, and proper error classification. It shows how to retry network timeouts but not authentication errors, stack timeout decorators with retry logic, and log retry attempts for debugging. The patterns handle both exceptions and HTTP status codes, with examples for synchronous and async code. Good for microservices that call flaky external APIs or any system where you need graceful degradation instead of immediate failures.
- skills.sh installs
- 12.2K
- GitHub stars
- 42.4K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add wshobson/agents --skill python-resilience --agent claude-codeInstalls into .claude/skills of the current project.
Files
Python Resilience Patterns
Build fault-tolerant Python applications that gracefully handle transient failures, network issues, and service outages. Resilience patterns keep systems running when dependencies are unreliable.
When to Use This Skill
- Adding retry logic to external service calls
- Implementing timeouts for network operations
- Building fault-tolerant microservices
- Handling rate limiting and backpressure
- Creating infrastructure decorators
- Designing circuit breakers
Core Concepts
1. Transient vs Permanent Failures
Retry transient errors (network timeouts, temporary service issues). Don't retry permanent errors (invalid credentials, bad requests).
2. Exponential Backoff
Increase wait time between retries to avoid overwhelming recovering services.
3. Jitter
Add randomness to backoff to prevent thundering herd when many clients retry simultaneously.
4. Bounded Retries
Cap both attempt count and total duration to prevent infinite retry loops.
Quick Start
from tenacity import retry, stop_after_attempt, wait_exponential_jitter
Sponsors
Details
- Repository
- github.com/wshobson/agents
- Category
- Python
More from wshobson/agents
All 174- Market Sizing Analysis12.2K
- Memory Safety Patterns12.2K
- Gitops Workflow12.1K
- Python Observability12K
- Shellcheck Configuration12K
- Python Configuration12K
- Cost Optimization11.9K
- Embedding Strategies11.8K
- Data Quality Frameworks11.7K
- Startup Metrics Framework11.7K
- Go Concurrency Patterns11.7K
- Prometheus Configuration11.6K
- Billing Automation11.6K
- K8s Manifest Generator11.6K
- Python Background Jobs11.6K
- Ml Pipeline Workflow11.5K
- Context Driven Development11.5K
- Dependency Upgrade11.5K
- Competitive Landscape11.5K
- Bats Testing Patterns11.4K
- Memory Forensics11.4K
- Risk Metrics Calculation11.4K
- Python Resource Management11.4K
- Binary Analysis Patterns11.4K