redis_openai_agents.with_async_retry#
- with_async_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 an async function.
Example
>>> @with_async_retry(max_retries=3, base_delay=0.1) ... async def fetch_from_redis(): ... return await 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 async function with retry logic
- Return type:
Callable[[Callable[[…], T]], Callable[[…], T]]