circuit_breaker

Patrón circuit breaker con pybreaker/tenacity para aislar fallos de agentes sin afectar al sistema completo

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "circuit_breaker" with this command: npx skills add davidcastagnetoa/skills/davidcastagnetoa-skills-circuit-breaker

circuit_breaker

El circuit breaker detecta cuando un servicio/agente está fallando repetidamente y corta el flujo de peticiones temporalmente, evitando la cascada de fallos y permitiendo recuperación.

When to use

Envolver todas las llamadas a servicios externos, modelos ML y otros agentes con un circuit breaker.

Instructions

  1. Instalar: pip install pybreaker tenacity.
  2. Con pybreaker:
    import pybreaker
    face_match_breaker = pybreaker.CircuitBreaker(fail_max=5, reset_timeout=60)
    
    @face_match_breaker
    def call_face_match_service(embedding_1, embedding_2):
        return face_match_client.compare(embedding_1, embedding_2)
    
  3. Estados: CLOSED (normal) → OPEN (fallo, rechaza peticiones) → HALF_OPEN (prueba recuperación).
  4. Configurar fail_max=5 (5 fallos consecutivos → OPEN) y reset_timeout=60 (60s antes de HALF_OPEN).
  5. En OPEN: devolver respuesta de fallback o error con código específico SERVICE_UNAVAILABLE.
  6. Emitir métrica a Prometheus cuando el breaker cambia de estado.

Notes

  • tenacity complementa el circuit breaker con retry + backoff exponencial para errores transitorios.
  • Cada agente debe tener su propio circuit breaker con parámetros ajustados a su SLO.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

apscheduler_celery_beat

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

gitops_argocd

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

dependabot_renovate

No summary provided by upstream source.

Repository SourceNeeds Review
General

traefik

No summary provided by upstream source.

Repository SourceNeeds Review