judgevet.adapters.outbound.retries

Status: draft.

judgevet.adapters.outbound.retries

Bound opt-in retries without changing service-error classifications.

Defaults and jitter follow the timing values documented at https://docs.typesafe.ai/sdk/python/api/retries.md. Unlike that SDK, judgevet requires opt-in for retries and separately for transport failures.

Examples:

from judgevet.adapters.outbound.retries import RetryPolicy

assert RetryPolicy().max_attempts == 1
See Also

RetryPolicy dataclass

Hold validated attempt and delay limits.

Attributes:

Name Type Description
max_attempts int

Total attempts including the initial request.

retry_base_delay float

Initial delay ceiling in seconds.

retry_max_delay float

Maximum delay ceiling in seconds.

retry_transport bool

Permit replay when a transport failure has no status.

Examples:

policy = RetryPolicy(max_attempts=3)
assert policy.retry_transport is False

__post_init__()

Reject limits that cannot provide bounded attempts and delays.

Raises:

Type Description
ValueError

If attempts are not a positive integer or delays are invalid.

arun(operation) async

Await an operation and cancellable retry delays.

Parameters:

Name Type Description Default
operation Callable[[], Awaitable[T]]

One asynchronous request with translated errors.

required

Returns:

Type Description
T

The successful operation result.

Raises:

Type Description
JevError

The final error when replay is disallowed or exhausted.

permits(error, attempt)

Decide whether the failed attempt permits another request.

Parameters:

Name Type Description Default
error JevError

The translated service error.

required
attempt int

Number of requests already attempted.

required

Returns:

Type Description
bool

Whether the error and remaining attempt budget permit replay.

run(operation)

Run a synchronous operation with bounded retry delays.

Parameters:

Name Type Description Default
operation Callable[[], T]

One request with translated errors.

required

Returns:

Type Description
T

The successful operation result.

Raises:

Type Description
JevError

The final error when replay is disallowed or exhausted.