Agent Resilience Skill — Circuit Breaker & Fault Tolerance Protocol for AI Agents

$0.05 / access SKILL.md protocol

The agent-resilience-skill is a 7-phase SKILL.md behavioral protocol for building fault-tolerant agentic workflows. It teaches agents how to implement circuit breakers that stop cascading failures, configure exponential backoff retry logic with jitter to prevent retry storms, select the right fallback strategy when dependencies fail, track error budgets against SLOs, propagate deadlines across tool call chains, apply graceful degradation patterns, and validate resilience with chaos testing. Compatible with Claude, OpenAI Codex CLI, Cursor, AWS Kiro, AutoGen, CrewAI, and LangGraph.

Why agent resilience is non-negotiable in production: An agent that retries a failing tool call without circuit protection can burn an entire token budget in seconds. A single unhandled timeout in a 10-tool chain can leave the agent in a partial state with irreversible side effects. This protocol gives agents the same resilience primitives that production SRE teams use — applied to LLM tool call graphs.

What's Covered (7 Phases)

PhaseTopicKey Output
1Circuit Breaker ImplementationCLOSED/OPEN/HALF_OPEN state machine with failure threshold and recovery probe logic
2Exponential Backoff Retry LogicRetry decision tree, idempotency check, jitter formula, total budget cap
3Fallback Strategy SelectionHierarchy: Primary → Stale Cache → Degraded Response → Static Default → Fail Gracefully
4Error Budget TrackingSLO definition, rolling window error budget tracker, alert thresholds (warn/critical/exhausted)
5Timeout and Deadline ManagementTimeout hierarchy with deadline propagation across orchestrator and sub-tool calls
6Graceful Degradation PatternsDegradation level matrix (NORMAL/DEGRADED/CRITICAL/MAINTENANCE) with feature permission map
7Chaos Testing for Tool Call ChainsChaos test harness with failure injection scenarios and acceptance criteria checklist

Target Keywords Covered

Code Sample — Circuit Breaker Pattern

// From agent-resilience-skill Phase 1
// Circuit breaker prevents retry storms on failing tool calls

type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN';

class CircuitBreaker {
  private state: CircuitState = 'CLOSED';
  private failureCount = 0;

  async call<T>(fn: () => Promise<T>): Promise<T> {
    if (this.state === 'OPEN') {
      const elapsed = Date.now() - this.lastFailureTime;
      if (elapsed < this.config.timeout) {
        throw new Error(`Circuit OPEN — retry after ${this.config.timeout - elapsed}ms`);
      }
      this.state = 'HALF_OPEN'; // Probe to test recovery
    }
    try {
      const result = await fn();
      this.onSuccess();
      return result;
    } catch (error) {
      this.onFailure(); // Opens circuit after threshold
      throw error;
    }
  }
}

// One circuit per tool call boundary
const priceFeedBreaker = new CircuitBreaker('price-feed', {
  failureThreshold: 3,   // Open after 3 failures
  successThreshold: 1,   // Close after 1 successful probe
  timeout: 15_000,       // Probe after 15 seconds
});

Use Cases

How to Install

One-line install via npx skills:

npx skills install agent-resilience-skill

This fetches the SKILL.md protocol and makes it available to your agent runtime. Compatible with Claude Code, OpenAI Codex CLI, Cursor, and any SKILL.md-aware agent framework.

How to Access via x402

  1. Free preview: GET https://clawmerchants.com/v1/preview/agent-resilience-skill — inspect protocol structure before paying
  2. Probe: GET https://clawmerchants.com/v1/data/agent-resilience-skill → HTTP 402 with USDC payment details
  3. Pay: Send $0.05 USDC on Base L2 (chain ID 8453) to the provider address in the 402 response
  4. Receive: Resend with X-PAYMENT: <base64 proof> → HTTP 200 with full 7-phase resilience protocol
# Step 1: Probe — discover payment requirements
curl -i https://clawmerchants.com/v1/data/agent-resilience-skill
# HTTP/1.1 402 Payment Required
# X-Payment-Required: {"amount":"50000","currency":"USDC","chain":8453,...}

# Step 2: Pay + resend with proof
curl -H "X-PAYMENT: <base64-payment-proof>"      https://clawmerchants.com/v1/data/agent-resilience-skill
# HTTP/1.1 200 OK — returns full agent-resilience-skill SKILL.md protocol

Pricing

$0.05 USDC per access — no subscription, no API key, no account required. Purchase once, apply the protocol to every agent you build. The circuit breaker pattern alone prevents retry storms that can burn $5–50 in API costs in a single runaway agent session — a 100-1000× return on the protocol cost.

Install via npx: npx skills install agent-resilience-skill
Free preview: GET /v1/preview/agent-resilience-skill
Probe the endpoint: GET https://clawmerchants.com/v1/data/agent-resilience-skill
Browse all agent skills: Agent Skills Marketplace →

ClawMerchants — agent resilience skill | circuit breaker for AI agents | fault tolerance agent workflow SKILL.md | agent retry protocol | resilient agent design | x402 + USDC + Base L2