# Interface ICircuitBreaker

Interface for circuit breaker operations.

interface ICircuitBreaker {
execute<T>(fn: () => Promise<T>): Promise<Result<T, CircuitError>>;
getState(): CircuitState;
getSnapshot(): CircuitBreakerSnapshot;
reset(): void;
recordFailure(category: CircuitBreakerFailureCategory): void;
recordSuccess(): void;
}

- Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:98

##### Index

### Methods

execute
getState
getSnapshot
reset
recordFailure
recordSuccess

## Methods

### execute

- execute<T>(fn: () => Promise<T>): Promise<Result<T, CircuitError>>

  Executes a function with circuit breaker protection.

  #### Type Parameters

  - T

  #### Parameters

  - fn: () => Promise<T>

  #### Returns Promise<Result<T, CircuitError>>

  - Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:102

### getState

- getState(): CircuitState

  Gets the current circuit state.

  #### Returns CircuitState

  - Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:107

### getSnapshot

- getSnapshot(): CircuitBreakerSnapshot

  Gets a full snapshot of circuit breaker state.

  #### Returns CircuitBreakerSnapshot

  - Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:112

### reset

- reset(): void

  Manually resets the circuit breaker to closed state.

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:117

### recordFailure

- recordFailure(category: CircuitBreakerFailureCategory): void

  Records a failure manually (for external failure detection).

  #### Parameters

  - category: CircuitBreakerFailureCategory

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:122

### recordSuccess

- recordSuccess(): void

  Records a success manually (for external success detection).

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/circuit-breaker-types.ts:127