agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
40 lines • 2.17 kB
TypeScript
/**
* agentfootprint/resilience — what happens when the call fails.
*
* Both halves of staying up, behind one name:
*
* • Provider decorators — `withRetry`, `withFallback`, `fallbackProvider`,
* `withCircuitBreaker`. Each preserves the `LLMProvider` interface, so
* they stack freely around any provider.
* • The rules engine — `.reliability({ postDecide: [...] })`'s typed rule
* shapes, the fail-fast error, the pure breaker state machine, and the
* schema-retry helpers.
*
* ## One name that exists twice, said out loud
*
* `CircuitOpenError` is TWO different classes: the decorator throws one
* (`src/resilience/withCircuitBreaker.ts`), the reliability gate throws
* another (`src/reliability/CircuitBreaker.ts`), and they differ in
* constructor and in `instanceof`. This door carries the DECORATOR's — the
* one a consumer catches, since it is the one that escapes a provider call.
*
* The gate's stays reachable at `agentfootprint/reliability` because it is a distinct runtime class.
* If you `instanceof`-check the error thrown by the reliability gate, keep
* importing it from there. Merging them would have changed the message text
* on one path, and this release changes packaging only.
*
* `CircuitState` also exists twice, but the two are byte-identical
* (`'closed' | 'open' | 'half-open'`), so the one re-exported here satisfies
* both and no consumer can tell the difference.
*
* @example
* ```ts
* import { withRetry, withFallback, type ReliabilityRule } from 'agentfootprint/resilience';
* ```
*/
export * from '../resilience/index.js';
export type { CircuitBreakerConfig, ReliabilityConfig, ReliabilityDecision, ReliabilityFallbackFn, ReliabilityProvider, ReliabilityRule, ReliabilityScope, } from '../reliability/types.js';
export { ReliabilityFailFastError } from '../reliability/types.js';
export { initialBreakerState, type BreakerState } from '../reliability/CircuitBreaker.js';
export { defaultStuckLoopRule, lastNValidationErrorsMatch, ValidationFailure, type OutputSchemaValidator, } from '../core/agent/stages/reliabilityExecution.js';
//# sourceMappingURL=resilience.d.ts.map