PyBreaker brings the Circuit Breaker pattern to Python, letting you wrap any integration point — database calls, HTTP requests, queue operations — with a component that automatically stops forwarding calls when the downstream system is unhealthy. When the system recovers, PyBreaker seamlessly re-enables traffic.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielfm/pybreaker/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
Protect your first integration point in under 5 minutes
Core Concepts
Understand states, thresholds, and how the breaker works
API Reference
Full reference for CircuitBreaker and all public classes
Guides
Decorators, listeners, Redis storage, async support, and more
Why PyBreaker?
In distributed systems, a slow or failing dependency can exhaust thread pools and connection resources, eventually taking down the entire application. PyBreaker implements the Circuit Breaker pattern described in Michael T. Nygard’s Release It! to prevent this class of failure.Thread-Safe
Built on Python’s
threading.RLock — safe to use across threads and concurrent requestsFlexible Usage
Use as a decorator, call directly, or use the
with context manager — whatever fits your code styleRedis Backing
Distribute circuit breaker state across multiple processes or nodes with optional Redis storage
Event Listeners
Hook into state changes, failures, and successes with
CircuitBreakerListenerSmart Exceptions
Exclude business exceptions so only real system errors count against the failure threshold
Fully Typed
Ships with complete type annotations and a
py.typed marker for mypy and pyrightHow It Works
Create a circuit breaker
Instantiate
CircuitBreaker once, at application scope, for each integration point you want to protect.PyBreaker requires Python 3.10 or later. Redis and Tornado integrations are optional extras.
