redis_openai_agents.with_retry#

with_retry(max_retries=3, base_delay=0.1, max_delay=10.0, exponential_base=2, jitter=True, retryable_exceptions=(<class 'redis.exceptions.ConnectionError'>, <class 'redis.exceptions.TimeoutError'>))[source]#

Decorator that adds retry logic to a sync function.

Example

>>> @with_retry(max_retries=3, base_delay=0.1)
... def fetch_from_redis():
...     return client.get("key")
Parameters:
  • max_retries (int) – Maximum retry attempts

  • base_delay (float) – Base delay in seconds

  • max_delay (float) – Maximum delay cap

  • exponential_base (float) – Exponential backoff base

  • jitter (bool) – Whether to add random jitter

  • retryable_exceptions (tuple[type[Exception], ...]) – Tuple of exception types to retry

Returns:

Decorated function with retry logic

Return type:

Callable[[Callable[[…], T]], Callable[[…], T]]