The two obvious additions are state-change callbacks (on_open, on_close, on_half_open) and a sliding-window failure rate instead of consecutive failure count. Callbacks would make it easy to emit a metric or alert when the circuit opens in production. You would call your logging or metrics function inside on_open and then know in real time how long each outage window lasted. Sliding window handles soft degradation better than consecutive count does: if 60% of requests fail but not in a strict sequence, consecutive count never trips, but sliding window will. For now, consecutive count ships because it is simpler to reason about and it handles the hard-outage scenario that caused this library to exist. The sliding-window variant is the next branch.
Part of the Hermes Agent Challenge sprint. Source at github.com/MukundaKatta/llm-circuit-breaker-py. PyPI: pip install llm-circuit-breaker-py.