---
name: "tool-calling-retry-exponential-backoff"
description: "Handle tool execution failures with exponential backoff and corrective error formatting."
metadata:
  author: "Tenacity"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "retry failed tool call"
  - "exponential backoff api"
  - "handle tool execution error"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Tool Calling Fault Tolerance & Backoff

Implements fault-tolerant tool calling: catching network timeouts, formatting error messages into descriptive feedback, applying jittered exponential backoff, and switching to fallback tools.

## When to Invoke
Invoke this skill whenever you need to:
- retry failed tool call
- exponential backoff api
- handle tool execution error

## Execution SOP & Rules
1. Catch transient errors (network timeouts, 429 rate limits, 503 gateway errors) and retry.
2. Apply exponential backoff: sleep(min(max_backoff, base * 2 ** attempt + random_jitter)).
3. Return informative error context in Observation blocks rather than crashing the agent loop.
4. Cap retries to 3 attempts before escalating to alternative tools or asking for human input.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
