Agent Maturity Compass API - v1.2.0
    Preparing search index...

    Function withCircuitBreaker

    • Execute a function with circuit breaker protection.

      • If circuit is CLOSED: execute normally, track success/failure
      • If circuit is OPEN: reject immediately (unless recovery window elapsed → HALF_OPEN)
      • If circuit is HALF_OPEN: allow limited attempts, close on success, reopen on failure
      • All executions are time-bounded by per-hook or global timeout

      Type Parameters

      • T

      Parameters

      • circuitName: string
      • fn: () => Promise<T>
      • Optionaloptions: { timeoutMs?: number }

      Returns Promise<T>