From d876a35d700b4473738fa79d2534bcbd8134a01c Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Sat, 21 Mar 2026 13:36:09 +0100 Subject: [PATCH] vault: add risk assessment and best practices to Trading Agents plan --- .../Trading Agents 混合架构方案.md | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/2 - Projects/Trading-Agents/Trading Agents 混合架构方案.md b/2 - Projects/Trading-Agents/Trading Agents 混合架构方案.md index 2710d9d..0435ddd 100644 --- a/2 - Projects/Trading-Agents/Trading Agents 混合架构方案.md +++ b/2 - Projects/Trading-Agents/Trading Agents 混合架构方案.md @@ -285,7 +285,44 @@ ssh $REMOTE "openclaw gateway restart" --- -## 八、与 TradingAgents 的差异 +## 八、风险与应对(Review 发现) + +### 风险 1:sessions_send 消息回声 Bug + +[Issue #7804](https://github.com/openclaw/openclaw/issues/7804):`sessions_send` 的 A2A flow 会把 assistant 回复作为新的 `role=user` 消息回注,导致 agent 看到自己的输出并再次回复,形成混乱循环。 + +> **应对**:在辩论 agent 的 AGENTS.md 中加入明确指令——如果收到的消息与自己上一条回复内容相同,回复 `REPLY_SKIP` 终止循环。升级 OpenClaw 到最新版后此问题可能已修复。 + +### 风险 2:Token 成本失控 + +每次完整辩论 = 4 次分析 + 6-10 轮辩论 + 4-6 轮风控 + 裁决 ≈ **15-20 次 LLM 调用**。[研究显示](https://sparkco.ai/blog/optimize-llm-api-costs-token-strategies-for-2025)输出 token 价格是输入的 4-8 倍。 + +> **应对**: +> - 分析 skill 要求 LLM 输出**结构化 JSON**([省 15% token](https://sparkco.ai/blog/optimize-llm-api-costs-token-strategies-for-2025)) +> - 辩论 agent SOUL.md 加入字数限制(每轮 300-500 字) +> - 风控辩论设 `maxPingPongTurns: 3`(风控观点 2-3 轮即收敛) +> - 分析师用便宜模型(Haiku),辩论用强模型(Opus/Sonnet) + +### 风险 3:Agent Stuck 导致流程卡死 + +知识库记录 invest-analyst 曾出现 stuck 并被 health-monitor 重启。如果辩论 agent stuck,整个流程会卡住。 + +> **应对**: +> - `sessions_send` 使用 `timeoutSeconds` 参数(建议 120s) +> - 超时后跳过辩论,直接基于分析报告出裁决 +> - 输出中标注"⚠️ 辩论未完成,置信度降低" +> - 依赖 OpenClaw health-monitor 自动重启 stuck agent + +### 最佳实践参考 + +- [Hub-and-Spoke 优于 Mesh](https://www.onabout.ai/p/mastering-multi-agent-orchestration-architectures-patterns-roi-benchmarks-for-2025-2026):中心编排者模式在生产环境更可预测、更易调试 +- [3-7 个 Agent 最佳](https://dev.to/eira-wexford/how-to-build-multi-agent-systems-complete-2026-guide-1io6):低于 3 个不需要多 agent,高于 7 个协调开销超过收益 +- [异构 Agent 效果更好](https://link.springer.com/article/10.1007/s44443-025-00353-3):不同角色用不同人格和模型,比同构 agent 准确率高 4-6% +- [结构化输出优于散文](https://tradingagents-ai.github.io/):JSON 报告比自然语言更高效传递信息 + +--- + +## 九、与 TradingAgents 的差异 | 维度 | TradingAgents (LangGraph) | OpenClaw 混合架构 | |------|---|---|