from agent.tools import ToolResult, tool from examples.piaoquan_demand.topic_build_pattern_tools import _log_tool_input, _log_tool_output @tool( "系统化思考与规划工具。不会获取新信息或更改数据库,只用于记录思考过程。" ) def think_and_plan(thought: str, thought_number: int, action: str, plan: str) -> str: """这是用于系统化思考与规划的工具,支持在面对复杂选题构建任务时分阶段梳理思考、规划和行动步骤。该工具不会获取新信息或更改数据库,只会将想法附加到记忆中。 Args: thought: 当前的思考内容,可以是对问题的分析、假设、洞见、反思或对前一步骤的总结。 thought_number: 当前思考步骤的编号,用于追踪和回溯整个思考与规划过程。 action: 基于当前思考和计划,建议下一步采取的行动步骤。 plan: 针对当前任务拟定的计划或方案。 Returns: A string describing the thought, plan, and action steps. """ params = { "thought": thought, "thought_number": thought_number, "action": action, "plan": plan, } _log_tool_input("think_and_plan", params) result = ( f"[思考 #{thought_number}]\n" f"思考: {thought}\n" f"计划: {plan}\n" f"下一步: {action}\n" f"(此工具仅用于记录思考过程,不会修改任何数据)" ) return _log_tool_output("think_and_plan", result)