Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Agent Fault Tolerance Recovery

    1

    Implement crash recovery, exponential backoff, and state checkpointing for resilient autonomous agent workflows.

    $15

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Agent Fault Tolerance Recovery

    Agent Fault Tolerance Recovery

    Example session with this skill installed

    Create a fault-tolerant Python agent loop for a web research task that uses SQLite for checkpoints and handles scraper timeouts with a fallback to a cached search result.

    • Read your context and instructions
    • Compiled the agent fault tolerance

    I have implemented the fault-tolerant agent loop with SQLite checkpointing and exponential backoff logic. The system is designed to resume from the last successful tool call if a crash occurs.

    Agent Resilience Implementation

    import sqlite3
    import time
    import random
    import json
    
    class ResilientAgent:
        def __init__(self, db_path="agent_state.db"):
            self.db_path = db_path
            self._init_db()
    
        def _init_db(self):
            with sqlite3.connect(self.db_path) as conn:
                conn.execute("CREATE TABLE IF NOT EXISTS checkpoints (id TEXT PRIMARY KEY, state TEXT, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP)")
    
        def save_checkpoint(self, task_id, state):
            with sqlite3.connect(self.db_path) as conn:
                conn.execute("INSERT OR REPLACE INTO checkpoints (id, state) VALUES (?, ?)", (task_id, json.dumps(state)))
    
        def load_checkpoint(self, task_id):
            with sqlite3.connect(self.db_path) as conn:
                row = conn.execute("SELECT state FROM checkpoints WHERE id = ?", (task_id,)).fetchone()
                return json.loads(row[0]) if row else None
    
        def execute_with_retry(self, tool_func, fallback_func, max_retries=3):
            for attempt in range(max_retries):
                try:
                    # Exponential backoff with jitter
                    wait = (2 ** attempt) + random.uniform(0, 1)
                    if attempt > 0: time.sleep(wait)
                    return tool_func()
                except Exception as e:
                    print(f"Attempt {attempt + 1} failed: {e}")
            return fallback_func()
    
    # Research Workflow Logic
    def research_task(agent, task_id):
        state = agent.load_checkpoint(task_id) or {"step": "init", "data": []}
        
        if state["step"] == "init":
            result = agent.execute_with_retry(primary_scraper, cached_search_fallback)
            state["data"].append(result)
            state["step"] = "completed"
            agent.save_checkpoint(task_id, state)
        
        return state
    

    Next steps

    1. Configure your .env file with SCRAPER_API_KEY to enable the primary tool.
    2. Run a test crash simulation by interrupting the script during the primary_scraper call.
    3. Review references/technical-guide.md to adjust backoff jitter parameters for production loads.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Unreliable tool calls and network timeouts often derail long-running autonomous workflows, leading to lost state and wasted tokens. This skill provides the architectural patterns and implementation logic needed to make agents resilient through persistent checkpoints and automated recovery.

    What it does

    • Persistent Checkpointing implements JSON or SQLite state snapshots after every successful tool execution to prevent data loss.
    • Resilient Retries designs exponential backoff strategies with jitter to handle transient API and network failures.
    • Fallback Logic configures alternative tool paths, such as switching from a scraper to a cached archive when primary sources fail.
    • Crash Recovery enables agents to resume execution from the last verified checkpoint after container restarts or crashes.
    • Atomic State Management ensures that state transitions are treated as atomic units to prevent corruption during failures.

    How it works

    1. Define the long-running workflow and identify high-risk tool integrations or API boundaries.
    2. Generate the state machine logic including checkpoint persistence hooks for each step.
    3. Configure the backoff parameters and jitter settings for specific failure modes.
    4. Implement the fallback handlers for secondary tool execution.

    Frameworks & tools

    Works with agent frameworks supporting state persistence, including LangGraph, CrewAI, and custom Python or TypeScript agent loops. Utilizes SQLite or JSON for local state and standard environment variables for secret management.

    Why this beats prompting it yourself

    Generic prompts often ignore the complexity of atomic state updates and the necessity of jitter in backoff strategies. This skill enforces strict reliability engineering principles, ensuring your agent doesn't just retry blindly but recovers intelligently from the exact point of failure.

    Use cases

    • Recovering data processing agents after a container OOM or restart.
    • Handling rate limits and transient 5xx errors in high-volume API workflows.
    • Ensuring multi-step web research tasks don't restart from scratch on failure.
    • Building resilient MCP server integrations that handle tool timeouts gracefully.

    Known limitations

    Restricted to local project workspace file operations. Requires the host environment to support either filesystem writes for JSON/SQLite or an external state database.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.

    Requires environment support for filesystem writes or SQLite. Logic is restricted to the active project workspace. External secret management must be handled via environment variables.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    Software
    Zero global installation
    orelevated privileges required.

    File System Read/Write (strictly scoped to current project workspace `./`).

    Permissions

    Read Files

    Target Use Cases: - Implement checkpointing and state recovery for AI agents. - Build a self-healing autonomous agent that survives crashes. - Configure exponential backoff and tool fallback for LLM agents.

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    This skill provides the architectural logic and implementation patterns to prevent agents from losing their progress during crashes, network timeouts, or API failures, saving you significant token costs and execution time.

    It is designed for frameworks that support state persistence, such as LangGraph and CrewAI, and can be integrated into custom Python or TypeScript agent loops that allow for external state management.

    You will receive the implementation logic for persistent checkpointing, exponential backoff configurations with jitter, fallback handlers, and the state machine hooks required to enable atomic recovery.

    Yes, this skill is specifically designed to handle transient 5xx errors and rate limits by implementing intelligent retry strategies that prevent your agent from hitting API walls or entering infinite loops.

    Setup requires identifying your high-risk integration points and configuring the provided hooks to point to your preferred storage method, such as a local SQLite database or JSON file system.

    New in Agents & Orchestration