ruFlo Agent Metrics 命令详解:从性能指标查看多 Agent 集群的 V3 运行状态

发布时间:2026/9/12 15:55:28
ruFlo Agent Metrics 命令详解:从性能指标查看多 Agent 集群的 V3 运行状态 ruFlo Agent Metrics 命令详解从性能指标查看多 Agent 集群的 V3 运行状态【免费下载链接】ruflo The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated项目地址: https://gitcode.com/GitHub_Trending/cl/ruflo导读agent metrics是 ruFloClaude Flow V3 CLI提供的 Agent 性能指标查看命令用于汇总统计当前多 Agent 集群在指定时间窗口内的运行情况——包括 Agent 总数、活跃数量、任务完成量、成功率以及 V3 引擎带来的 Flash Attention、HNSW 向量检索等性能增益。本文以 v3/claude-flow/cli/.claude/commands/agents/metrics.md 为骨架结合 agent.ts 源码中的真实数据链路与 commands.test.ts 测试用例带你掌握命令用法、读懂每一项指标的含义并理解这些数字在底层是从哪里采集来的。命令总览与适用场景npx claude-flow/clilatest agent metrics [agent-id] [options]agent metrics属于agent命令族的子命令。与agent list列出活跃 Agent、agent status查看单个 Agent 详情不同metrics面向的是全局视角它聚合所有已生成spawned的 Agent给出群体层面的运行健康度与性能画像。典型适用场景多 Agent 并行开发 / 研究 / 测试任务结束后快速核对任务完成率与成功率排查集群是否存在大量空闲或终止的 Agent结合 V3 性能指标Flash Attention、HNSW 检索判断底层神经网络与向量检索是否按预期生效在 CI / 脚本中以 JSON 格式导出指标供监控面板或自动化工具消费。参数与选项选项短选项说明默认值--period-p统计时间窗口1h、24h、7d、30d24h--format无输出格式table终端表格或jsontable[agent-id]无位置参数限定只统计指定 Agent全部 Agent从源码看metrics子命令注册的选项是period默认24h位置参数agent-id通过ctx.args[0]获取见 agent.ts 的 metricsCommand 定义。当传入了agent-id时它主要用于筛选信息素调度Pheromone Scheduling表中的 Agent其余汇总指标仍然面向全部 Agent。常用示例# 最近 24 小时的整体指标 npx claude-flow/clilatest agent metrics # 指定 Agent 的指标 npx claude-flow/clilatest agent metrics coder-lx7m9k2 # 最近 1 小时 npx claude-flow/clilatest agent metrics -p 1h # 最近 7 天 npx claude-flow/clilatest agent metrics --period 7d # JSON 输出 npx claude-flow/clilatest agent metrics --format json其中-p 1h适合高频监控场景--period 7d适合周报统计--format json适合管道化处理。命令在无参数时仍可运行若当前工作区从未生成过 Agent汇总区会显示提示源码中以note字段输出 No agents spawned yet. Use: agent spawn -t coder见 agent.ts。终端输出解读文档中给出了agent metrics的三段式输出结构对应源码中的实际输出逻辑见 agent.tsAgent Metrics (24h) ------------------------------ | Metric | Value | ------------------------------ | Total Agents | 4 | | Active Agents | 3 | | Tasks Completed | 127 | | Success Rate | 96.2% | | Total Tokens | 1,234,567| | Avg Response Time | 1.45s | ------------------------------ By Agent Type ----------------------------------- | Type | Count | Tasks | Success | ----------------------------------- | coder | 2 | 45 | 97% | | researcher | 1 | 32 | 95% | | tester | 1 | 50 | 98% | ----------------------------------- V3 Performance Gains - Flash Attention: 2.8x speedup - Memory Reduction: 52% - Search: 150x faster需要说明的是上表中Total Tokens、Avg Response Time与V3 Performance Gains三行属于文档中的理想输出示例。对照当前仓库 agent.ts 的实际实现真实输出包含的是Total Agents、Active Agents、Tasks Completed、Success Rate、Memory Vectors五项汇总以及By Agent Type表和Memory段Vectors 数量与后端是否为 HNSW-indexed。V3 性能数据Flash Attention、HNSW、SONA则通过performance benchmark或status等命令单独呈现详见下文V3 性能指标的来源一节。若当前存在运行中的pheromone-adaptive拓扑 swarm终端还会追加输出信息素调度Pheromone Scheduling表。汇总指标Summary Metrics含义指标含义Total Agents统计周期内生成的全部 Agent 数量Active Agents当前处于 active / running 状态的 Agent 数量Tasks Completed所有 Agent 成功完成的任务总数Success Rate成功任务占全部任务的比例Total Tokens所有 Agent 消耗的 Token 总量文档示例字段Avg Response Time任务平均完成耗时文档示例字段Memory Vectors当前记忆库中的向量数量源码实际输出字段来自 memory.db 大小估算按 Agent 类型分解By Agent Type表格按coder、researcher、tester等类型聚合每行给出该类型的 Agent 数量Count、任务数Tasks与成功率Success。这在混合多 Agent 工作流中非常实用可以一眼看出哪类 Agent 的任务吞吐最高、哪类 Agent 的成功率偏低、需要重点排查。JSON 输出与自动化集成{ period: 24h, summary: { totalAgents: 4, activeAgents: 3, tasksCompleted: 127, avgSuccessRate: 96.2%, totalTokens: 1234567, avgResponseTime: 1.45s }, byType: [ { type: coder, count: 2, tasks: 45, successRate: 97% } ], performance: { flashAttention: 2.8x speedup, memoryReduction: 52%, searchImprovement: 150x faster } }对应源码中构造的metrics对象见 agent.ts实际 JSON 结构为{ period: 24h, summary: { totalAgents: 4, activeAgents: 3, tasksCompleted: 127, avgSuccessRate: 96.2%, vectorCount: 1280, note: No agents spawned yet. Use: agent spawn -t coder }, byType: [ { type: coder, count: 2, tasks: 45, successRate: 97% } ], performance: { memoryVectors: 1280 vectors, searchBackend: HNSW-indexed }, pheromone: { active: true, dryRun: true, threshold: 0.5, agents: [ { agentId: coder-xxx, role: coder, pheromoneScore: 0.83, rawScore: 0.9, samples: 12, eligibility: eligible } ] } }--format json时命令会调用output.printJson(metrics)直接输出该结构agent.ts非常适合被jq等工具继续加工。指标从哪里来源码级数据链路agent metrics的亮点在于不依赖外部监控服务直接从工作区的本地状态文件实时聚合。数据链路如下见 agent.ts.swarm/agents/*.json遍历该目录下所有 JSON 文件逐个读取 Agent 的type、statusactive/running计为活跃、tasksCompleted、successCount据此累加 Total Agents、Active Agents、Tasks Completed并生成byType分类型统计。.swarm/swarm-activity.json当 Agent 目录为空时回退读取该文件中的totalAgents、activeAgents作为补充。.swarm/memory.db若存在记忆数据库用dbSize / 2048估算向量数量vectorCount并据此推断searchBackend是否为HNSW-indexed。.claude-flow/swarm/swarm-state.jsonADR-330 引入的信息素调度APSC状态读取——筛选出status running且topology pheromone-adaptive的 swarm提取每个 Agent 的emaScore信息素评分、rawScore、samples与suspended状态映射为可读的pheromoneScore与eligibility。与之配套的写入侧是updateSwarmActivityMetrics()函数agent.ts每次agent spawn或agent stop执行后都会更新.claude-flow/metrics/swarm-activity.json中的swarm.agent_count供 statusline 展示集群 Agent 数量。也就是说spawn/stop 是写入端metrics 是读取端二者共同构成了一套基于文件系统的轻量监控闭环。V3 性能指标的背后Flash Attention / HNSW / SONA文档中的 V3 Performance Gains 表格对应仓库内 V3 引擎的核心优化目标指标目标区间说明仓库依据Flash Attention2.49x–7.47x神经注意力加速neural.ts 中--flash选项描述 Enable Flash Attention (2.49x-7.47x speedup)Memory Reduction50–75%量化带来的显存/内存节省performance.ts 中 Enable HNSW index quantization, impact 50% reductionHNSW Search150x–12,500x向量检索加速memory.ts HNSW indexing (150x-12,500x faster)SONA Adaptation0.05ms实时自适应学习performance.ts 中 SONA benchmark 以0.05ms ✓判定达标在 performance.ts 的基准实现中这些数字是可实测的它会对flashAttentionSearch做多次采样取均值与 p95/p99 分位调用getHNSWStatus()获取 HNSW 索引条目数并对比暴力搜索估算 O(log n) 加速比注释标明 HNSW should be O(log n) ~150x faster并通过benchmarkAdaptation()测量 SONA 自适应延迟以微秒计。因此agent metrics文档中引用的这些增益区间本质上是 V3 引擎设计目标与performance benchmark命令的验收标准。与相关命令的配合使用文档末尾列出了三组关联命令构成完整的 Agent 可观测体系# 单个 Agent 的详细指标任务完成/进行中/失败、平均执行耗时、运行时长 npx claude-flow/clilatest agent status # 全量性能基准Flash Attention / HNSW / SONA 实测 npx claude-flow/clilatest performance benchmark # 系统级状态总览含 V3 性能状态如 Flash Attention、HNSW 索引启用情况 npx claude-flow/clilatest statusagent status的响应体包含metrics字段tasksCompleted、tasksInProgress、tasksFailed、averageExecutionTime、uptime是agent metrics的单点放大镜performance benchmark对应 performance.ts是 V3 性能数字的实测来源status命令在总览中输出Flash Attention: status与 HNSW 索引开关状态见 status.ts 与 #L682适合作为每次会话开始时的健康检查。测试验证与可靠性agent metrics的行为由单元测试覆盖见 commands.test.ts测试一调用agentCommand.subcommands中名为metrics的子命令执行断言result.success true且结果同时包含summary与performance两个属性测试二以period: 7d传入 flags验证--period选项可正常接受并执行。这说明metrics命令的对外契约成功标志、summary/performance 结构、period 选项已被自动化测试固定可以在脚本或 CI 中安全依赖。小结agent metrics是 ruFlo 多 Agent 运维中最直接的仪表盘一条命令即可掌握集群规模、活跃度、任务吞吐与成功率结合--format json可无缝接入自动化监控配合agent status、performance benchmark、status命令则能形成从全局指标 → 单点详情 → 性能基准 → 系统健康的完整可观测链路。而理解其数据来源于.swarm/与.claude-flow/下的状态文件能帮助你在排查异常时快速定位是 Agent 状态写入问题还是统计口径本身的问题。【免费下载链接】ruflo The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated项目地址: https://gitcode.com/GitHub_Trending/cl/ruflo创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考