ORCHCRAFT
Reliability · Established

Retry & Fallback

Also known as: Retry with backoff, Graceful degradation

Retry & fallback re-attempts a failed step under a declared policy of attempts and backoff, and switches to an alternative path when retries are exhausted or the error is not retryable.

01Problem it solves

Remote calls fail transiently (timeouts, rate limits, overloaded providers). Failing the whole workflow on the first error is fragile, while unbounded retries amplify outages.

02Use when / Avoid when

Use when

  • Steps call networks, APIs or models with transient failure modes.
  • An acceptable alternative exists: a second provider, a cached value or a reduced answer.
  • Retry behaviour should be declared per step rather than written ad hoc.

Avoid when

  • The step is not idempotent and a duplicate would cause harm.
  • The failure is deterministic (validation error, bad input); retrying only wastes time.
  • Callers need a fast failure more than an eventual success.

03How it works

  1. 1AttemptThe step runs with a timeout.
  2. 2ClassifyOn error, decide whether it is retryable.
  3. 3Back offWait with exponential backoff and jitter, then retry up to the maximum attempts.
  4. 4Fall backIf retries are exhausted, run the fallback path or fail with a clear error.

04Capabilities

CapabilityWhat it means
Automatic retriesFailed steps are re-attempted according to a declared policy (attempts, backoff, retryable errors) rather than ad hoc code.
Fallback pathsWhen a step keeps failing, execution switches to a declared alternative (another provider, model, cache or degraded answer).

05Tradeoffs

AspectYou gainYou pay
AvailabilityAbsorbs transient failures without human action.Adds latency on the failure path.
LoadBackoff spreads recovery traffic.Retries at several layers multiply load during an outage.
QualityFallbacks keep the system answering.Fallback answers may be degraded; users may not notice.

06Failure considerations

Failure modeMitigation
Retry storms: every layer retries and multiplies traffic on a struggling dependency.Retry at one layer only, add jitter and pair with a circuit breaker.
Duplicate side effects from retried non-idempotent calls.Use idempotency keys or make the operation naturally idempotent.
Fallback hides a persistent outage.Emit metrics and alerts on fallback usage.

07Implementations

Examples of products and frameworks that implement this pattern. Listed as evidence, not endorsement.

ImplementationMechanism
TemporalDurable execution engineDeclarative retry policies per Activity (attempts, backoff, non-retryable errors).
Apache AirflowWorkflow schedulerPer-task retries and retry delays; trigger rules route around failures.
PrefectWorkflow schedulerRetries with configurable delays on tasks and flows.
AWS Step FunctionsCloud workflow serviceRetry and Catch fields on each state.
Azure Durable FunctionsCloud workflow serviceActivity calls accept retry options.
DagsterWorkflow schedulerRetry policies on ops and assets.

09Requirements that lead here