返回顶部
s

swarm群蜂策略

Cut your LLM costs by 200x. Offload parallel, batch, and research work to Gemini Flash workers instead of burning your expensive primary model.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.3.7
安全检测
已通过
3,479
下载量
免费
免费
8
收藏
概述
安装方式
版本历史

swarm

Swarm — 将您的LLM成本降低200倍

将您昂贵的模型转变为日常可负担的工具。将繁琐任务交给Gemini Flash工作节点——并行处理、批量处理、研究——成本仅为一小部分。

概览

30项任务通过时间成本
Opus(顺序执行)~30秒~$0.50
Swarm(并行执行)
~1秒 | ~$0.003 |

使用场景

Swarm适用于:

  • - 3个以上独立任务(研究、总结、对比)
  • 比较或研究多个主题
  • 多个需要获取/分析的URL
  • 批量处理(文档、实体、事实)
  • 需要多视角的复杂分析 → 使用链式处理

快速参考

bash

检查守护进程(每次会话执行)


swarm status

如果未运行则启动

swarm start

并行提示

swarm parallel 什么是X? 什么是Y? 什么是Z?

研究多个主题

swarm research OpenAI Anthropic Mistral --topic AI安全

发现能力

swarm capabilities

执行模式

并行模式 (v1.0)

N个提示 → N个工作节点同时执行。最适合独立任务。

bash
swarm parallel 提示1 提示2 提示3

研究模式 (v1.1)

多阶段:搜索 → 获取 → 分析。使用Google搜索基础。

bash
swarm research Buildertrend Jobber --topic 2026年定价

链式模式 (v1.3) — 优化流水线

数据流经多个阶段,每个阶段有不同的视角/过滤器。阶段按顺序执行;阶段内的任务并行执行。

阶段模式:

  • - parallel — N个输入 → N个工作节点(相同视角)
  • single — 合并输入 → 1个工作节点
  • fan-out — 1个输入 → N个工作节点(不同视角)
  • reduce — N个输入 → 1个综合输出

自动链式 — 描述您的需求,获得最优流水线:
bash
curl -X POST http://localhost:9999/chain/auto \
-d {task:寻找商业机会,data:...市场数据...,depth:standard}

手动链式:
bash
swarm chain pipeline.json


echo {stages:[...]} | swarm chain --stdin

深度预设: quick(2阶段)、standard(4阶段)、deep(6阶段)、exhaustive(8阶段)

内置视角: 提取器、过滤器、丰富器、分析器、综合器、挑战者、优化器、策略师、研究员、评论家

预览而不执行:
bash
curl -X POST http://localhost:9999/chain/preview \
-d {task:...,depth:standard}

基准测试 (v1.3)

使用LLM作为评委评分,比较单次、并行和链式模式在同一任务上的表现。

bash
curl -X POST http://localhost:9999/benchmark \
-d {task:分析X,data:...,depth:standard}

在6个FLASK维度上评分:准确性(2倍权重)、深度(1.5倍)、完整性、连贯性、可操作性(1.5倍)、细微差别。

能力发现 (v1.3)

让编排器发现可用的执行模式: bash swarm capabilities

curl http://localhost:9999/capabilities

提示缓存 (v1.3.2)

LLM响应的LRU缓存。缓存命中时加速212倍(并行模式),链式模式加速514倍

  • - 键值由指令+输入+视角的哈希值决定
  • 最多500条,TTL为1小时
  • 跳过网络搜索任务(需要最新数据)
  • 守护进程重启后持久化到磁盘
  • 按任务绕过:设置 task.cache = false

bash

查看缓存统计


curl http://localhost:9999/cache

清除缓存

curl -X DELETE http://localhost:9999/cache

缓存统计显示在 swarm status 中。

阶段重试 (v1.3.2)

如果链式阶段内的任务失败,仅重试失败的任务(而非整个阶段)。默认:1次重试。可通过 phase.retries 按阶段配置,或通过 options.stageRetries 全局配置。

成本追踪 (v1.3.1)

所有端点在其 complete 事件中返回成本数据:

  • - session — 当前守护进程会话总计
  • daily — 跨重启持久化,全天累积

bash
swarm status # 显示会话+每日成本
swarm savings # 月度节省报告

网络搜索 (v1.1)

工作节点通过Google搜索基础搜索实时网络(仅限Gemini,无额外成本)。

bash

研究默认使用网络搜索


swarm research 主题 --topic 角度

并行模式带网络搜索

curl -X POST http://localhost:9999/parallel \ -d {prompts:[X的当前价格?],options:{webSearch:true}}

JavaScript API

javascript
const { parallel, research } = require(~/clawd/skills/node-scaling/lib);
const { SwarmClient } = require(~/clawd/skills/node-scaling/lib/client);

// 简单并行
const result = await parallel([提示1, 提示2, 提示3]);

// 带流式传输的客户端
const client = new SwarmClient();
for await (const event of client.parallel(prompts)) { ... }
for await (const event of client.research(subjects, topic)) { ... }

// 链式
const result = await client.chainSync({ task, data, depth });

守护进程管理

bash
swarm start # 启动守护进程(后台)
swarm stop # 停止守护进程
swarm status # 状态、成本、缓存统计
swarm restart # 重启守护进程
swarm savings # 月度节省报告
swarm logs [N] # 守护进程日志的最后N行

性能 (v1.3.2)

模式任务数时间备注
并行(简单)5~700ms每任务有效142ms
并行(压力)
10 | ~1.2s | 每任务有效123ms | | 链式(标准) | 5 | ~14s | 3阶段多视角 | | 链式(快速) | 2 | ~3s | 2阶段提取+综合 | | 缓存命中 | 任意 | ~3-5ms | 加速200-500倍 | | 研究(网络) | 2 | ~15s | Google基础延迟 |

配置

位置:~/.config/clawdbot/node-scaling.yaml

yaml
node_scaling:
enabled: true
limits:
max_nodes: 16
maxconcurrentapi: 16
provider:
name: gemini
model: gemini-2.0-flash
web_search:
enabled: true
parallel_default: false
cost:
maxdailyspend: 10.00

故障排除

问题解决方法
守护进程未运行swarm start
无API密钥
设置 GEMINIAPIKEY 或运行 npm run setup | | 速率限制 | 在配置中降低 maxconcurrentapi | | 网络搜索不工作 | 确保provider为gemini且web_search.enabled为true | | 缓存结果过时 | curl -X DELETE http://localhost:9999/cache | | 链式太慢 | 使用 depth: quick 或检查上下文大小 |

结构化输出 (v1.3.7)

强制JSON输出并带模式验证——结构化任务零解析失败。

bash

使用内置模式


curl -X POST http://localhost:9999/structured \
-d {prompt:从以下内容提取实体:蒂姆·库克发布了iPhone 17,schema:entities}

使用自定义模式

curl -X POST http://localhost:9999/structured \ -d {prompt:分类此文本,data:...,schema:{type:object,properties:{category:{type:string}}}}

JSON模式(无模式,仅强制JSON)

curl -X POST http://localhost:9999/structured \

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 swarm-1776385220 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 swarm-1776385220 技能

通过命令行安装

skillhub install swarm-1776385220

下载

⬇ 下载 swarm v1.3.7(免费)

文件大小: 139.23 KB | 发布时间: 2026-4-17 13:58

v1.3.7 最新 2026-4-17 13:58
v1.3.5-1.3.7: Self-reflection, Skeleton-of-Thought, Structured Output, Majority Voting. Quality sprint complete.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部