Tenacity

Python retry library that wraps functions with configurable retry logic including exponential backoff, jitter, stop conditions, and custom wait strategies via decorators or context managers.

Evaluated Mar 06, 2026 (0d ago) vcurrent
Homepage ↗ Repo ↗ Developer Tools python library retry backoff resilience decorator fault-tolerance
⚙ Agent Friendliness
71
/ 100
Can an agent use this?
🔒 Security
92
/ 100
Is it safe for agents?
⚡ Reliability
90
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
92
Error Messages
88
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
95
Auth Strength
95
Scope Granularity
90
Dep. Hygiene
90
Secret Handling
90

No network layer; secure by default. No external calls, no credential handling.

⚡ Reliability

Uptime/SLA
88
Version Stability
90
Breaking Changes
88
Error Recovery
92
AF Security Reliability

Best When

You need robust, configurable retry logic for LLM API calls, external HTTP requests, or transient I/O failures with minimal boilerplate.

Avoid When

You are retrying operations with side effects that are not idempotent and you have not implemented deduplication at the callee.

Use Cases

  • Wrapping LLM API calls (OpenAI, Anthropic) with exponential backoff and jitter to handle rate limit 429 errors gracefully
  • Retrying flaky external HTTP requests in agent tool calls without writing boilerplate retry loops
  • Implementing circuit-breaker-like patterns by combining retry limits with exception filtering for database connections
  • Adding retry resilience to agent subtask execution where transient failures should not abort the entire workflow
  • Retrying file I/O operations that may fail transiently due to filesystem locks or network mounts

Not For

  • Non-idempotent operations that must not be duplicated — retrying POST requests that create resources will cause duplicates
  • Permanent errors that will never succeed on retry — retrying auth failures or 404s wastes time without a meaningful exception filter
  • Async-heavy workflows where asyncio-native retry libraries like aioretry offer better integration without thread-blocking

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Local Python library, no auth required

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Apache 2.0 license

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Documented

Known Gotchas

  • Default retry is infinite with no stop condition — always set stop=stop_after_attempt(N) or stop=stop_after_delay(seconds) to prevent runaway retries
  • retry=retry_if_exception_type must be specific or all exceptions including KeyboardInterrupt and SystemExit will be caught and retried
  • wait_exponential without jitter causes thundering herd when multiple agents retry simultaneously — always add wait_random_min/max
  • The @retry decorator reruns the entire function including any non-idempotent side effects that occurred before the failure point
  • reraise=True is not the default — without it, the final exception is wrapped in RetryError and original traceback context is harder to extract

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Tenacity.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered