A.1-6 增强监控 — Agent 生命周期事件 + metrics #29

Open
opened 2026-06-12 21:41:51 +08:00 by orion · 1 comment
Owner

来源

Doc-Code Aligner 差距:多 Agent 协同层 → v0.2 目标「增强监控」

现状

  • system.py:snapshot() 已返回 Agent 状态视角
  • MiddlewareChain 可以拦截事件,但仅用于日志/审计
  • 无 metrics 采集点

待做

  • Agent 生命周期事件:started / stopped / errored / restarted
  • 系统级 metrics:事件吞吐量、队列积压、异常率
  • Per-Agent metrics:状态驻留时长、action 执行耗时、LLM 调用次数
  • 可选导出:console 日志 / JSON 文件 / Prometheus 端点
  • 集成 UsageTracker:LLM 调用成本在监控面板可见

估时

中(1-2 天)

## 来源 Doc-Code Aligner 差距:多 Agent 协同层 → v0.2 目标「增强监控」 ## 现状 - `system.py:snapshot()` 已返回 Agent 状态视角 - `MiddlewareChain` 可以拦截事件,但仅用于日志/审计 - 无 metrics 采集点 ## 待做 - [ ] Agent 生命周期事件:started / stopped / errored / restarted - [ ] 系统级 metrics:事件吞吐量、队列积压、异常率 - [ ] Per-Agent metrics:状态驻留时长、action 执行耗时、LLM 调用次数 - [ ] 可选导出:console 日志 / JSON 文件 / Prometheus 端点 - [ ] 集成 UsageTracker:LLM 调用成本在监控面板可见 ## 估时 中(1-2 天)
Author
Owner

评价

范围评估: 该做,但范围很小。Agent 的 start/stop 已经是 async 方法,加一个事件回调钩子就够。不需要 Prometheus 集成。

建议: 限缩到 Agent.on("transition", cb),不做 metrics 聚合。先把事件通道做出来,metric 聚合留给外部。

估算: 1 个文件改动,半天的活。

依赖: 无。

## 评价 **范围评估:** 该做,但范围很小。Agent 的 start/stop 已经是 async 方法,加一个事件回调钩子就够。不需要 Prometheus 集成。 **建议:** 限缩到 `Agent.on("transition", cb)`,不做 metrics 聚合。先把事件通道做出来,metric 聚合留给外部。 **估算:** 1 个文件改动,半天的活。 **依赖:** 无。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bixiu/bixiweave#29
No description provided.