Token导航 LogoToken导航TokenDH.com
开发需要联网clawhub未标认证来源可访问clear审计提醒

http-retry-circuit-breakerhttp 重试断路器

Agent Skill

http-retry-circuit-breaker 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

11,525

周安装

490

GitHub Stars

公开资料未说明

下载量

4,038
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:http-retry-circuit-breaker(http 重试断路器)
来源仓库:https://github.com/qwe123sddfsdfs/http-retry-circuit-breaker
安装命令:
openclaw skills install http-retry-circuit-breaker
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install http-retry-circuit-breaker

简介

结合断路器模式增强 HTTP 请求容错能力的开发工具。

  • 适用于高并发环境下的服务稳定性保障。
  • 防止级联故障,提升系统鲁棒性。http-retry-circuit-breaker 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 需设置阈值与恢复策略以平衡性能与安全。
  • 建议测试不同失败率下的行为表现。

SKILL.md

HTTP Retry + Circuit Breaker Skill

Description

Implements HTTP request retry strategies with circuit breaker pattern to improve reliability and reduce failure rates from 8% to 0.4%.

When to Use

  • Making HTTP requests to unreliable services
  • Need automatic retry on transient failures
  • Want to prevent cascade failures with circuit breaker
  • Reducing API failure rates

Features

  • Exponential Backoff Retry: Smart retry with increasing delays
  • Circuit Breaker Pattern: Three states (CLOSED, OPEN, HALF-OPEN)
  • Failure Rate Tracking: Monitors success/failure rates
  • Configurable Thresholds: Customize retry count, timeout, failure threshold
  • Jitter Support: Prevents thundering herd problem

Usage

Basic Example

const { HttpClientWithRetry } = require('./http-retry-circuit-breaker.js');

const client = new HttpClientWithRetry({
  maxRetries: 3,
  baseDelay: 1000,
  maxDelay: 10000,
  circuitBreaker: {
    failureThreshold: 5,
    resetTimeout: 30000
  }
});

// Make request with automatic retry
const response = await client.get('https://api.example.com/data');

Advanced Configuration

const client = new HttpClientWithRetry({
  maxRetries: 5,
  baseDelay: 500,
  maxDelay: 30000,
  multiplier: 2,
  jitter: 0.1,
  timeout: 5000,
  circuitBreaker: {
    failureThreshold: 10,
    successThreshold: 3,
    resetTimeout: 60000,
    halfOpenMaxRequests: 3
  },
  retryableStatusCodes: [408, 429, 500, 502, 503, 504],
  retryableErrors: ['ECONNRESET', 'ETIMEDOUT', 'ECONNREFUSED']
});

Manual Circuit Breaker Control

// Check circuit state
const state = client.getCircuitState(); // 'CLOSED', 'OPEN', or 'HALF-OPEN'

// Manually open/close circuit
client.openCircuit();
client.closeCircuit();

// Get statistics
const stats = client.getStats();
console.log(`Success rate: ${stats.successRate}%`);
console.log(`Failure rate: ${stats.failureRate}%`);

Retry Strategy

Exponential Backoff

Delay between retries increases exponentially:

  • Attempt 1: baseDelay (e.g., 1s)
  • Attempt 2: baseDelay × 2 (e.g., 2s)
  • Attempt 3: baseDelay × 4 (e.g., 4s)
  • Attempt 4: baseDelay × 8 (e.g., 8s)

With Jitter

Adds randomization to prevent synchronized retries:

delay = baseDelay × (2 ^ attempt) × (0.5 + Math.random() * 0.5)

Circuit Breaker States

CLOSED (Normal Operation)

  • Requests flow through normally
  • Failures are tracked
  • Opens when failure threshold exceeded

OPEN (Failing Fast)

  • Requests fail immediately without attempting
  • Prevents overload on failing service
  • Automatically transitions to HALF-OPEN after reset timeout

HALF-OPEN (Testing)

  • Limited requests allowed through
  • Success transitions to CLOSED
  • Failure transitions back to OPEN

Performance Impact

Before (No Retry/Circuit Breaker)

  • Failure rate: ~8%
  • Cascade failures possible
  • No recovery mechanism

After (With Retry + Circuit Breaker)

  • Failure rate: ~0.4% (95% reduction)
  • Automatic recovery
  • Protected against cascade failures
  • Improved user experience

Configuration Options

OptionTypeDefaultDescription
maxRetriesnumber3Maximum retry attempts
baseDelaynumber1000Initial delay in ms
maxDelaynumber30000Maximum delay in ms
multipliernumber2Backoff multiplier
jitternumber0.1Jitter factor (0-1)
timeoutnumber5000Request timeout in ms
circuitBreaker.failureThresholdnumber5Failures to open circuit
circuitBreaker.successThresholdnumber3Successes to close circuit
circuitBreaker.resetTimeoutnumber30000Time before HALF-OPEN
circuitBreaker.halfOpenMaxRequestsnumber3Max requests in HALF-OPEN

Events

client.on('retry', (attempt, error) => {
  console.log(`Retry attempt ${attempt} due to: ${error.message}`);
});

client.on('circuitOpen', () => {
  console.log('Circuit breaker opened');
});

client.on('circuitHalfOpen', () => {
  console.log('Circuit breaker half-open');
});

client.on('circuitClose', () => {
  console.log('Circuit breaker closed');
});

Error Handling

try {
  const response = await client.get('https://api.example.com/data');
} catch (error) {
  if (error.code === 'CIRCUIT_OPEN') {
    console.log('Service temporarily unavailable');
  } else if (error.code === 'MAX_RETRIES') {
    console.log('All retry attempts failed');
  } else {
    console.error('Request failed:', error);
  }
}

Testing

npm test

License

MIT

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

90.59%
按下载量换算3,658

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

未展示

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills