resilience-pipeline wraps calls to things that fail: HTTP APIs, databases, queues, LLM providers. You describe how to
react to failure once, as a pipeline of strategies, and run any call through it.
Polly-style builder with a shortcut for every strategy: addRetry(), addTimeout(), addCircuitBreaker(), …
Convenient, but it bundles every strategy. For the smallest browser bundle use PipelineBuilder with
retryStrategy(), timeoutStrategy(), … instead; the two are interchangeable.
The type parameters track which errors the pipeline can raise, for pipeline.settle() + Outcome.match().
Polly-style builder with a shortcut for every strategy: addRetry(), addTimeout(), addCircuitBreaker(), …
Convenient, but it bundles every strategy. For the smallest browser bundle use PipelineBuilder with
retryStrategy(), timeoutStrategy(), … instead; the two are interchangeable.
The type parameters track which errors the pipeline can raise, for pipeline.settle() + Outcome.match().
Aborted when the caller cancels, or when a strategy (timeout, hedging) gives up on this execution.
signal));
Each attempt gets a 2-second timeout and passes through the circuit breaker. Transient failures are retried with
exponential backoff; once the breaker opens, calls fail fast instead of piling onto a dead service.
The API follows Polly v8: ResiliencePipelineBuilder, addRetry, shouldHandle,
PredicateBuilder, the same option and event names. It is an independent TypeScript implementation with no
runtime dependencies. It runs on Node.js ≥ 20.16, Bun, Deno, Cloudflare Workers and browsers.