Skip to content

Retry policy

TransportRetryPolicy is the client HTTP retry policy. It retries transient network/request failures while talking to the Durable Workflow server; it does not retry workflow runs, workflow tasks, activities, child workflows, or user code.

Durable retry budgets live on workflow commands instead:

  • ActivityRetryPolicy with ctx.schedule_activity(...) controls attempts for one activity execution.
  • ChildWorkflowRetryPolicy with ctx.start_child_workflow(...) controls attempts for one child workflow execution.
  • Activity timeout fields and child workflow timeout fields are server-side durable budgets, not SDK HTTP request timeouts.

retry_policy

HTTP transport retry policy used inside :class:~durable_workflow.Client.

.. warning::

:class:TransportRetryPolicy covers only client-side HTTP retries for transient transport errors (connection failures, timeouts, 5xx responses, 429 rate-limiting). It is not the activity retry policy. Activity-level retry and timeout configuration lives on :class:durable_workflow.workflow.ActivityRetryPolicy and is passed to ctx.schedule_activity(..., retry_policy=...).

TransportRetryPolicy dataclass

TransportRetryPolicy(max_attempts=3, initial_backoff_seconds=0.1, max_backoff_seconds=5.0, backoff_multiplier=2.0, jitter=True)

Retry policy for transient HTTP transport errors.

Retries requests that fail with transient errors (connection errors, timeouts, 5xx server errors, 429 rate limit). Does not retry client errors (4xx except 429).

This policy runs inside :class:~durable_workflow.Client around HTTP requests. It does not retry workflow runs, workflow tasks, activity executions, child workflows, or any user code. Configure durable activity retries with :class:durable_workflow.workflow.ActivityRetryPolicy and child workflow retries with :class:durable_workflow.workflow.ChildWorkflowRetryPolicy.

Uses exponential backoff with jitter to avoid thundering herd.

should_retry

should_retry(exc, attempt)

Check if the error is retryable and we haven't exceeded max attempts.

backoff_seconds

backoff_seconds(attempt)

Calculate backoff duration for the given attempt number (0-indexed).

execute async

execute(fn)

Execute the given async function with retries.

Raises the last exception if all retries are exhausted.