fai-circuit-breaker-add — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited fai-circuit-breaker-add (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill defines a production-ready workflow for implementing the circuit breaker pattern for LLM API calls with configurable failure thresholds, exponential backoff, half-open state probing, and graceful fallback. It enforces full six-phase coverage, WAF-aligned quality gates, and reproducible delivery outcomes.
| Input | Description |
|---|---|
| Protected endpoint | Azure OpenAI or other LLM API endpoint |
| Failure threshold | Number of consecutive failures to trip the breaker (default: 5) |
| Recovery timeout | Seconds before half-open probe attempt (default: 30) |
| Fallback strategy | Cached response, smaller model, or graceful error message |
| State | Behavior |
|---|---|
| Closed | Requests flow normally; failures counted |
| Open | All requests short-circuit to fallback; timer starts |
| Half-Open | One probe request sent; success → Closed, failure → Open |
import time, threading
class CircuitBreaker:
def __init__(self, failure_threshold=5, recovery_timeout=30):
self.failure_threshold = failure_threshold
self.recovery_timeout = recovery_timeout
self.failure_count = 0
self.state = "closed" # closed, open, half-open
self.last_failure_time = 0
self._lock = threading.Lock()
def can_execute(self):
with self._lock:
if self.state == "closed":
return True
if self.state == "open":
if time.time() - self.last_failure_time >= self.recovery_timeout:
self.state = "half-open"
return True
return False
return True # half-open: allow one probedef call_llm_with_breaker(prompt, breaker, fallback_fn):
if not breaker.can_execute():
return fallback_fn(prompt)
try:
response = openai_client.chat.completions.create(
model="gpt-4o", messages=[{"role": "user", "content": prompt}]
)
breaker.record_success()
return response
except Exception as e:
breaker.record_failure()
if not breaker.can_execute():
return fallback_fn(prompt)
raisedef fallback_to_mini(prompt):
return openai_client.chat.completions.create(
model="gpt-4o-mini", messages=[{"role": "user", "content": prompt}]
)| Artifact | Purpose |
|---|---|
| Implementation artifacts | Code, config, and infrastructure files |
| Validation evidence | Test results, compliance checks, quality metrics |
| Rollback guide | Step-by-step reversal and mitigation procedures |
| Operate handoff | Monitoring setup, ownership, and escalation paths |
The skill is complete when all six phases have objective evidence, quality gates pass, and another engineer can reproduce outcomes without tribal knowledge.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.