You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The agent's invocation of the ReAct function for MCP is unstable. #19463
Regarding your issue, it seems that the instability might be related to the number of iterations set for the ReAct strategy. The qwen3:32b model has known limitations when using the ReAct strategy, particularly with tool-based operations when the maximum iterations are set to less than 3. It requires a configuration of max iterations equal to 3 to successfully execute such operations [2]. You might want to try adjusting the number of iterations to see if it resolves the instability.
Activity
dosubot commentedon May 9, 2025
I found a similar unsolved discussion that might be relevant to your issue: Sometimes the agent says it invoked the MCP tool but actually hasn't, yet still returns a result. This discussion was last updated on May 7, 2025 [1].
Regarding your issue, it seems that the instability might be related to the number of iterations set for the ReAct strategy. The qwen3:32b model has known limitations when using the ReAct strategy, particularly with tool-based operations when the maximum iterations are set to less than 3. It requires a configuration of max iterations equal to 3 to successfully execute such operations [2]. You might want to try adjusting the number of iterations to see if it resolves the instability.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
haofengW commentedon May 9, 2025
When I changed it to 4 times, even if the tool invocation was successful, the iteration would still continue.
As shown in the figure below
Jeff-CH-Y commentedon May 15, 2025
AgentNode非常需要优化,现在非常难用。MCP的各种策略也很难用。但是一旦好用dify就牛逼了,伸手党许愿
crazywoola commentedon Jul 7, 2025
Stability under ReACT mode depends on the model itself
haofengW commentedon Aug 2, 2025
I don't think so. With the same prompt words and the same model, in the directly - created Agent, the tool was correctly invoked and the result was returned immediately (as shown in Figure 1 below). However, in ChatFlow, after two rounds of thinking, it seems that the context was truncated in the second round (as shown in Figures 2 and 3 below). So it has nothing to do with the model itself. Moreover, the time taken to call the model in ChatFlow is far longer than that in the Agent.
The complete thinking process is as follows
{
"text": "\n好的,我现在需要处理用户的查询。首先,用户发来的是",
"files": [],
"json": [
{
"id": "e4bfbd23-d42e-4b5d-af42-661c181ebe8e",
"parent_id": null,
"error": null,
"status": "success",
"data": {
"action_input": {
"arguments": "{"transformer_id": "TR001"}",
"tool_name": "get_basic_info"
},
"action_name": "mcp_sse_call_tool",
"observation": "Tool execution result: [{'type': 'text', 'text': '{\n "status": "success",\n "message": "\\u6210\\u529f\\u83b7\\u53d6\\u53d8\\u538b\\u5668\\u57fa\\u7840\\u4fe1\\u606f",\n "transformer_id": "TR001",\n "data": {\n "items": [\n {\n "transformer_id": "TR001",\n "created_at": "2025-05-09T07:47:51.895051",\n "rated_capacity": "647MVA",\n "rated_voltage": "331kV",\n "rated_current": "331A",\n "impedance_voltage": "14%",\n "no_load_loss": "44kW",\n "load_loss": "303kW",\n "manufacture_date": "2016-02-14",\n "serial_number": "0a516424-8768-4aee-8cc9-366105e9c264",\n "winding_type": "YNd11",\n "core_material": "\\u975e\\u6676\\u5408\\u91d1",\n "cooling_type": "OFAF",\n "insulation_class": "A",\n "voltage_regulation_type": "\\u6709\\u8f7d\\u8c03\\u538b",\n "tap_changer_type": "\\u7535\\u5b50\\u5f0f",\n "tank_type": "\\u81ea\\u51b7\\u6cb9\\u7bb1",\n "updated_at": "2025-05-09T07:47:51.895051"\n }\n ]\n },\n "created_at": "2025-08-02 12:14:24"\n}'}]",
"thought": "\n好的,我现在需要处理用户的查询:“查询TR001的基础信息”。首先,我要确定用户的需求属于哪种情况。根据核心工作流程,情况1是当输入中不包含“observation: Tool execution result”时,需要调用工具。用户这里只是简单查询,没有之前的工具调用结果,所以属于情况1。\n\n接下来,我需要从接口清单中找到对应的服务。用户提到“基础信息”,根据参数映射表,“基础信息”对应的是get_basic_info接口。确认一下,参数需要transformer_id,这里用户提供了TR001,所以参数是transformer_id: "TR001"。其他参数如start_time和end_time是可选的,用户没有提到时间范围,所以不需要填写。\n\n然后,我需要构造正确的JSON动作。工具名称是mcp_sse_call_tool,参数需要tool_name和arguments。tool_name应该是get_basic_info,arguments需要是JSON字符串,包含transformer_id。注意参数格式要正确,用双引号,避免语法错误。\n\n检查一下参数是否正确:transformer_id是TR001,没有时间参数。所以arguments应该是{"transformer_id": "TR001"},转换成JSON字符串。然后调用mcp_sse_call_tool工具。\n\n确认没有其他工具需要调用,比如mcp_sse_list_tools是列出工具,但这里不需要。所以正确的动作是调用mcp_sse_call_tool,参数正确。现在生成对应的JSON blob。\n"
},
"label": "ROUND 1",
"metadata": {
"currency": "USD",
"elapsed_time": 28.70030255499296,
"finished_at": 199162.256750017,
"started_at": 199133.556447628,
"total_price": "0",
"total_tokens": 2255
},
"node_id": "1745158769067"
},
{
"id": "d4ce72c6-b4e4-4e9e-8420-dd4bb63edd4e",
"parent_id": "e4bfbd23-d42e-4b5d-af42-661c181ebe8e",
"error": null,
"status": "success",
"data": {
"action": "mcp_sse_call_tool",
"action_input": {
"arguments": "{"transformer_id": "TR001"}",
"tool_name": "get_basic_info"
},
"thought": "\n好的,我现在需要处理用户的查询:“查询TR001的基础信息”。首先,我要确定用户的需求属于哪种情况。根据核心工作流程,情况1是当输入中不包含“observation: Tool execution result”时,需要调用工具。用户这里只是简单查询,没有之前的工具调用结果,所以属于情况1。\n\n接下来,我需要从接口清单中找到对应的服务。用户提到“基础信息”,根据参数映射表,“基础信息”对应的是get_basic_info接口。确认一下,参数需要transformer_id,这里用户提供了TR001,所以参数是transformer_id: "TR001"。其他参数如start_time和end_time是可选的,用户没有提到时间范围,所以不需要填写。\n\n然后,我需要构造正确的JSON动作。工具名称是mcp_sse_call_tool,参数需要tool_name和arguments。tool_name应该是get_basic_info,arguments需要是JSON字符串,包含transformer_id。注意参数格式要正确,用双引号,避免语法错误。\n\n检查一下参数是否正确:transformer_id是TR001,没有时间参数。所以arguments应该是{"transformer_id": "TR001"},转换成JSON字符串。然后调用mcp_sse_call_tool工具。\n\n确认没有其他工具需要调用,比如mcp_sse_list_tools是列出工具,但这里不需要。所以正确的动作是调用mcp_sse_call_tool,参数正确。现在生成对应的JSON blob。\n"
},
"label": "qwen3:30b-a3b-thinking-2507-q8_0 Thought",
"metadata": {
"currency": "USD",
"elapsed_time": 28.578585013980046,
"finished_at": 199162.137023225,
"provider": "langgenius/ollama/ollama",
"started_at": 199133.558453503,
"total_price": "0",
"total_tokens": 2255,
"icon": "bfff83a66922c09cb5a5aa68829742b8b4f4e818579db42f53c7b8a30912cd8b.svg",
"icon_dark": null
},
"node_id": "1745158769067"
},
{
"id": "42c18eb0-7ca6-4ae5-b9e8-be0aa43cc371",
"parent_id": "e4bfbd23-d42e-4b5d-af42-661c181ebe8e",
"error": null,
"status": "success",
"data": {
"output": "Tool execution result: [{'type': 'text', 'text': '{\n "status": "success",\n "message": "\\u6210\\u529f\\u83b7\\u53d6\\u53d8\\u538b\\u5668\\u57fa\\u7840\\u4fe1\\u606f",\n "transformer_id": "TR001",\n "data": {\n "items": [\n {\n "transformer_id": "TR001",\n "created_at": "2025-05-09T07:47:51.895051",\n "rated_capacity": "647MVA",\n "rated_voltage": "331kV",\n "rated_current": "331A",\n "impedance_voltage": "14%",\n "no_load_loss": "44kW",\n "load_loss": "303kW",\n "manufacture_date": "2016-02-14",\n "serial_number": "0a516424-8768-4aee-8cc9-366105e9c264",\n "winding_type": "YNd11",\n "core_material": "\\u975e\\u6676\\u5408\\u91d1",\n "cooling_type": "OFAF",\n "insulation_class": "A",\n "voltage_regulation_type": "\\u6709\\u8f7d\\u8c03\\u538b",\n "tap_changer_type": "\\u7535\\u5b50\\u5f0f",\n "tank_type": "\\u81ea\\u51b7\\u6cb9\\u7bb1",\n "updated_at": "2025-05-09T07:47:51.895051"\n }\n ]\n },\n "created_at": "2025-08-02 12:14:24"\n}'}]",
"tool_call_args": {
"arguments": "{"transformer_id": "TR001"}",
"tool_name": "get_basic_info"
},
"tool_name": "mcp_sse_call_tool"
},
"label": "CALL mcp_sse_call_tool",
"metadata": {
"elapsed_time": 0.11897187499562278,
"finished_at": 199162.256590433,
"provider": "junjiem/mcp_sse/mcp_sse",
"started_at": 199162.137619017,
"icon": "/console/api/workspaces/current/plugin/icon?tenant_id=5c32de7c-12bc-4cf0-a269-1f1aa4f25609&filename=221f13757d18412c5db453374c10f539c671216dcc29456ed4695e86b9c756e8.png",
"icon_dark": ""
},
"node_id": "1745158769067"
},
{
"id": "bdca36ee-eeb9-4db1-9db2-89ec069b0fd7",
"parent_id": null,
"error": null,
"status": "success",
"data": {
"action_input": "",
"action_name": "",
"observation": "",
"thought": "\n好的,我现在需要处理用户的查询。首先,用户发来的是"
},
"label": "ROUND 2",
"metadata": {
"currency": "USD",
"elapsed_time": 11.441905921004945,
"finished_at": 199173.698725146,
"started_at": 199162.256819433,
"total_price": "0",
"total_tokens": 1896
},
"node_id": "1745158769067"
},
{
"id": "fe96f84a-d8ce-4823-aeec-a4a85862ba59",
"parent_id": "bdca36ee-eeb9-4db1-9db2-89ec069b0fd7",
"error": null,
"status": "success",
"data": {
"action": "\n好的,我现在需要处理用户的查询。首先,用户发来的是",
"thought": "\n好的,我现在需要处理用户的查询。首先,用户发来的是"
},
"label": "qwen3:30b-a3b-thinking-2507-q8_0 Thought",
"metadata": {
"currency": "USD",
"elapsed_time": 11.434410963003756,
"finished_at": 199173.697465104,
"provider": "langgenius/ollama/ollama",
"started_at": 199162.263066475,
"total_price": "0",
"total_tokens": 1896,
"icon": "bfff83a66922c09cb5a5aa68829742b8b4f4e818579db42f53c7b8a30912cd8b.svg",
"icon_dark": null
},
"node_id": "1745158769067"
},
{}
]
}