resilience-patterns

Implement circuit breakers, retries, bulkheads, and timeouts for fault-tolerant distributed systems.

Updated May 16, 2026
One-click install
npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill resilience-patterns-organvm-i-theoria
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: resilience-patterns
Source: https://github.com/organvm-i-theoria/_agent-ontology/tree/main/.agents/skills/resilience-patterns
Command: npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill resilience-patterns-organvm-i-theoria

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires httpx.

What problem does it solve? Distributed systems fail in partial and unpredictable ways, and unprotected service calls cause cascading outages, hanging requests, and thundering herds. This Skill provides ready-to-use Python patterns that keep services operating through transient errors and downstream failures. ## Core Features & Use Cases - Failure Containment Patterns: Async implementations of circuit breakers, retries with exponential backoff and jitter, bulkheads via semaphores, timeouts, and fallback chains. - Composed Resilient Client: A layered defense-in-depth client stacking timeout, bulkhead, circuit breaker, and retry around outbound HTTP calls, plus rate limiting, health checks, and idempotency handling. - Use Case: When your service calls an unstable third-party payment API, wrap the call in the ResilientClient so transient errors retry with backoff, sustained failures open the circuit, and duplicate charges are prevented with idempotency keys. ## Quick Start Ask the AI to add a circuit breaker and retry with exponential backoff around an unstable external API call in your Python service.

Frequently Asked Questions about resilience-patterns

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

FAQPage Schema
How do I implement a circuit breaker in Python?▼

Track consecutive failures and open the circuit after a threshold, rejecting calls until a recovery timeout elapses, then test with a half-open state. The Skill provides an async CircuitBreaker class with CLOSED, OPEN, and HALF_OPEN states wrapping any awaitable call.

How to add retry with exponential backoff to async Python functions?▼

Use a decorator that catches exceptions, waits base_delay times 2 to the attempt power plus random jitter, and re-raises after the final attempt. The Skill's retry decorator caps delay with a max_delay parameter to prevent excessive waits.

What is the difference between a bulkhead and a circuit breaker?▼

A bulkhead limits concurrent access to a resource using a semaphore, isolating failures so one slow dependency cannot exhaust all capacity. A circuit breaker stops calling a failing service entirely until it recovers, preventing wasted requests.

When should I not retry a failed request?▼

Never retry non-transient errors like HTTP 400 responses, which will fail identically on every attempt. Also avoid retrying without backoff, since simultaneous retries create a thundering herd that overwhelms recovering services.

How do I prevent duplicate payment processing on retries?▼

Use idempotency keys: store each processed request keyed by a unique idempotency key and return the existing result when the same key arrives again. This makes retried operations safe without charging customers twice.