aioretry
Asyncio retry utility for Python 3.7+
What it is and what it does
aioretry is a decorator library that wraps async functions to automatically retry them on failure according to a policy you define. You supply a retry policy function that receives information about each failure (attempt count, exception, elapsed time) and returns a decision: either abandon and raise the exception, or sleep for a specified delay before retrying. The decorator handles the async sleep and retry loop for you.
It supports flexible policy definitions—functions, methods, class methods, or static methods—and optional before-retry callbacks for logging or side effects. The library works with instance methods, class methods, and standalone async functions, making it suitable for network operations, database queries, or any async task that might transiently fail.
Use it for:
- Retry HTTP requests or API calls with exponential backoff when network timeouts or transient errors occur.
- Automatically retry database connection attempts with configurable delays during service startup.
- Implement circuit-breaker-like behavior by abandoning retries after a maximum failure count.
- Log or monitor each retry attempt via a before_retry callback to track failure patterns.
- Selectively retry only certain exception types while immediately failing on others.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a decorator-based retry mechanism for async functions in Python, allowing you to define custom retry policies that control when to retry, how long to wait between attempts, and when to give up.
Yes, if you need retry logic for async code. The library is lightweight, dependency-free, and straightforward to integrate. The aging maintenance status (540 days since release) is not a blocker—the API is stable and the recent repository activity suggests the maintainer is responsive. No known vulnerabilities. Install if your async workload benefits from configurable retry policies; skip if you prefer a heavier framework or have simple fixed-delay retry needs.
Install
aioretry on PyPI
pip
pip install aioretryuv
uv add aioretrypoetry
poetry add aioretryInstalling aioretry
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release was 540 days ago, though the repository remains active with a recent commit on 2025-02-20.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions; suitable for both open-source and commercial projects.
Quickstart
from aioretry import retry, RetryInfo
import asyncio
def retry_policy(info: RetryInfo):
return False, (info.fails - 1) % 3 * 0.1
@retry(retry_policy)
async def connect_to_server():
pass
asyncio.run(connect_to_server())
Requires Python 3.7 or later; target function must be async or return an awaitable.
Verify before relying
- Whether the aging maintenance status (540 days since last release) affects real-world reliability or if the stable API means infrequent updates are acceptable.
- Performance characteristics under high concurrency or with very frequent retries.
Package facts
| License | Copyright (c) 2013 kaelzhang <>, contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 540 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 130,941/month — #11,618 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aioretry-6.3.1-py3-none-any.whl
Keywords: aioretry
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
reretryA decorator and function wrapper for retrying…
permissive · top 15,000 on PyPI
retryProvides a decorator and function wrapper for…
permissive · top 1,000 on PyPI
retry2Provides a decorator and function wrapper to…
permissive · top 5,000 on PyPI
pyramid-retrypyramid_retry wraps Pyramid requests with…
permissive · top 15,000 on PyPI
python-retryProvides a decorator to automatically retry…
permissive · top 15,000 on PyPI
waiterWaiter provides iteration-based retry and…
permissive · top 15,000 on PyPI
retryingRetrying is a decorator-based library that adds…
permissive · top 1,000 on PyPI
awsretryA decorator that wraps AWS API calls to…
permissive · top 15,000 on PyPI
retry-decoratorProvides a decorator to automatically retry a…
permissive · top 15,000 on PyPI
eth-retryA decorator that automatically retries…
permissive · top 15,000 on PyPI