
Python Resilience Patterns
Teaches the agent to add retries, backoff, jitter and timeouts to Python code that calls unreliable services.
- Repository
- wshobson/agents
- Stars
- 42,095
- Licence
- MIT
- Files
- 2 files
What it does
Once this skill is installed, the agent writes Python code that handles temporary failures more carefully, such as a network call that times out or a server that briefly returns an overload error. It knows to retry only errors that might succeed on a second try, to wait longer between each attempt with random jitter, to cap total attempts and duration, and to always set timeouts. The skill's examples are built around the tenacity library and the httpx HTTP client.
Great for
- Python developers adding retry logic to calls to external APIs or microservices
- Teams building fault-tolerant services that must cope with rate limits (HTTP 429) or gateway errors (502-504)
- Developers who want a reference for which errors should and should not be retried
Skip it if
- Non-programmers or anyone not working in Python, since all examples are Python code
- Applications that must not repeat an action, such as payments or sending messages, unless the calls are idempotent; automatic retries can duplicate effects
- Projects already committed to a different retry library, where the agent's tenacity-specific advice would need adapting
Try asking
- “Add retry with exponential backoff and jitter to my function that calls the payments API via httpx”
- “Make this Python data-fetching function retry only on network errors and 429/503 responses”
- “Add timeouts and a bounded retry policy to our microservice client code”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 2 original files, the MIT licence and an attribution note.
python-resilience.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip python-resilience.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip python-resilience.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Name the specific service and the errors you see, so the agent can pick the right retryable exception list instead of a broad one.
- State whether the operation is idempotent, because retrying a non-idempotent request can cause duplicate effects.
- Ask the agent to add logging on each retry so that failures stay visible in production.
What's inside
- references/details.md
- SKILL.md
Redistributed unmodified from wshobson/agents under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.