diff --git a/pipeline_service/agent_loop_v2.py b/pipeline_service/agent_loop_v2.py index e272816..2aceb91 100644 --- a/pipeline_service/agent_loop_v2.py +++ b/pipeline_service/agent_loop_v2.py @@ -136,6 +136,21 @@ class AgentExecutor: action_type = act.get("action", "") if action_type == "reply": + # 第一轮就 reply 且没调过工具 → 强制注入 tool_call + if self._tool_call_count == 0 and turn == 0: + yield json.dumps({ + "type": "auto_tool", "message": "未调工具,自动注入 diagnose_project", + }, ensure_ascii=False) + "\n" + self._msgs.append({ + "role": "assistant", + "content": "已调用 diagnose_project", + }) + self._msgs.append({ + "role": "user", + "content": "请调用 diagnose_project 查看项目状态", + }) + continue # 不退出,继续下一轮 + final_reply = act.get("message", "") yield json.dumps({ "type": "reply", "message": final_reply,