[问题/Issue] 章节7.4:简短问题描述 / Chapter7.4: test_react代码运行错误
1. 遇到问题的章节 / Affected Chapter
7.4
2. 问题类型 / Issue Type
代码错误 / Code Error
3. 具体问题描述 / Problem Description
每一步没有输出
注册测试工具... ✅ 工具 'calculate' 已注册。 ✅ 计算器工具注册成功 ✅ 工具 'search' 已注册。 ✅ 搜索工具注册成功 ✅ 我的推理行动助手 初始化完成,最大步数: 5
============================================================ 开始测试 MyReActAgent
测试1:数学计算问题
我的推理行动助手 开始处理问题: 请帮我计算:(25 + 15) × 3 - 8 的结果是多少?
--- 第 1 步 ---
--- 第 2 步 ---
--- 第 3 步 ---
--- 第 4 步 ---
--- 第 5 步 --- ❌ 测试1失败: 'MyReActAgent' object has no attribute '_save_to_history'
4. 问题重现材料 / Reproduction Materials
注册测试工具... ✅ 工具 'calculate' 已注册。 ✅ 计算器工具注册成功 ✅ 工具 'search' 已注册。 ✅ 搜索工具注册成功 ✅ 我的推理行动助手 初始化完成,最大步数: 5
============================================================ 开始测试 MyReActAgent
测试1:数学计算问题
我的推理行动助手 开始处理问题: 请帮我计算:(25 + 15) × 3 - 8 的结果是多少?
--- 第 1 步 ---
--- 第 2 步 ---
--- 第 3 步 ---
--- 第 4 步 ---
--- 第 5 步 --- ❌ 测试1失败: 'MyReActAgent' object has no attribute '_save_to_history'
测试2:信息搜索问题
我的推理行动助手 开始处理问题: Python编程语言是什么时候发布的?请告诉我具体的年份。
--- 第 1 步 ---
--- 第 2 步 ---
--- 第 3 步 ---
--- 第 4 步 ---
--- 第 5 步 --- ❌ 测试2失败: 'MyReActAgent' object has no attribute '_save_to_history'
测试3:复合推理问题
我的推理行动助手 开始处理问题: 如果一个班级有30个学生,其中60%是女生,那么男生有多少人?请先计算女生人数,再计算男生人数。
--- 第 1 步 ---
--- 第 2 步 ---
--- 第 3 步 ---
--- 第 4 步 ---
--- 第 5 步 --- ❌ 测试3失败: 'MyReActAgent' object has no attribute '_save_to_history'
对话历史记录: 0 条消息 Traceback (most recent call last): File "hello-agents-1.0.0\code\chapter7\test_react_agent.py", line 142, in test_react_agent() File "hello-agents-1.0.0\code\chapter7\test_react_agent.py", line 83, in test_react_agent print(f"\n️ 可用工具数量: {len(tool_registry.tools)}") ^^^^^^^^^^^^^^^^^^^ AttributeError: 'ToolRegistry' object has no attribute 'tools'. Did you mean: '_tools'?
进程已结束,退出代码为 1
5. 补充信息 / Additional Information
No response
确认事项 / Verification
- 我已阅读过相关章节的文档 / I have read the relevant chapter documentation
- 我已搜索过现有的Issues,确认此问题未被报告 / I have searched existing Issues and confirmed this hasn't been reported
- 我已尝试过基本的故障排除(如重启、重新安装依赖等) / I have tried basic troubleshooting (restart, reinstall dependencies, etc.)
Source: datawhalechina/hello-agents