📋 Re-Act 事件日志
# 概述
框架内置 ReActLoggingHook,把 Agent 的 reason / act / error 事件写入 SLF4J 日志,便于在终端直接观察 Re-Act 推理过程。
# 日志格式
日志中的方括号 ID 为 conversationId:agentKey。
| 事件 | 日志格式 |
|---|---|
| 推理前 | [agent:reason][conversationId:agentKey] >>> model=... messages=N |
| 推理后 | [agent:reason][conversationId:agentKey] <<< text=... toolCalls=[...] |
| 推理后(用量) | [agent:reason][conversationId:agentKey] <<< usage input=N output=N total=N time=Ns |
| 行动前 | [agent:act][conversationId:agentKey] >>> tool=... input=... |
| 行动后 | [agent:act][conversationId:agentKey] <<< tool=... result=... |
| 错误 | [agent:error][conversationId:agentKey] ... |
# 配置
全局开关:
# 默认 true
liteflow.agent.logging.react-enabled=true
单组件开关:
@Override
protected boolean enableReActLogging() {
return false; // 关闭此组件的 Re-Act 日志
}
日志输出配置:
Logger 名为 com.yomahub.liteflow.agent.hook.ReActLoggingHook,可在 logback / log4j2 中独立调级。
提示
文本字段超过 500 字会被截断为 ...(truncated)。
如果业务侧已经通过自定义 Hook 处理事件流,建议关掉内置日志钩子以避免重复输出。想自己编写 Hook 做审计、埋点或事件改写,见 自定义 Hook。
帮助我们改善此文档 (opens new window)
上次更新: 2026/06/02, 00:29:19


