DAWN AI / ANALYSE
REV-01

ReAct 实现对比

Current impl  vs  Standard ReAct
当前:Tool-Calling Chat
目标:Reason → Act → Observe Loop
AgentOrchestrator — 当前实现
READ HISTORY
从 Redis 加载历史消息,构建 messages 列表
CALL LLM 单次
ChatClient.prompt().messages(history).user(msg)
.toolNames(...).call().content()
TOOL DISPATCH 框架代劳
工具调用由 Spring AI / 模型 function calling 自动处理
代码层无 Observe 步骤
WRITE MEMORY
写入 user + assistant 消息到 Redis,返回 response
NO  无 while 循环 · 无终止守卫 · 无 Observe
Standard ReAct — 目标实现
T
THOUGHT Reason
LLM 推理:分析目标,决定是否需要调用工具
A
ACTION Act
选择工具(weatherTool / calculatorTool),生成调用参数
O
OBSERVATION Observe
执行工具,将结果作为 ToolResponseMessage 注入上下文
REPEAT or STOP
判断是否完成:
• maxIterations 守卫
• timeout 守卫
• token budget 熔断
• 重复动作检测
YES  while(!done)  ·  Termination Guard  ·  Full Observe
Feature 当前实现 标准 ReAct
控制循环 单次调用,无 while while(!done) 显式循环
Thought 步骤 无显式 Thought 记录 每轮记录推理链 (CoT)
Action 分发 Spring AI function calling 自动 手动解析 + 路由工具调用
Observation 注入 框架内部处理,代码不可见 ToolResponseMessage 显式入 history
终止守卫 无 maxIterations / timeout 多层 TerminationGuard
Token 预算 无累计 token 统计 CircuitBreaker 按 token 熔断
会话记忆 Redis + TTL,已实现 Redis / 长期向量记忆
Tool 注册 toolNames() 注册,已实现 动态 Tool 注册 + 描述
RAG 增强 PGVector + context inject 向量检索 + 分层记忆
可观测性 Micrometer + Prometheus 每步 trace + token 指标
重复动作检测 相邻轮次 action 去重
全部
缺失
部分
已实现