From 460acf40c0eb5ad32ea00c92a6a406a7c765bdc0 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Mar 2026 14:16:14 +0800 Subject: [PATCH] fix: apply max_agent_step config to subagents (#5608) * Initial plan * fix: apply max_agent_step config to subagents Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * fix: streamline max_agent_step and streaming_response retrieval in FunctionToolExecutor --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: Soulter <905617992@qq.com> --- astrbot/core/astr_agent_tool_exec.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/astrbot/core/astr_agent_tool_exec.py b/astrbot/core/astr_agent_tool_exec.py index fd6db5a98..0dc8b9eeb 100644 --- a/astrbot/core/astr_agent_tool_exec.py +++ b/astrbot/core/astr_agent_tool_exec.py @@ -291,6 +291,9 @@ class FunctionToolExecutor(BaseFunctionToolExecutor[AstrAgentContext]): except Exception: continue + prov_settings: dict = ctx.get_config(umo=umo).get("provider_settings", {}) + agent_max_step = int(prov_settings.get("max_agent_step", 30)) + stream = prov_settings.get("streaming_response", False) llm_resp = await ctx.tool_loop_agent( event=event, chat_provider_id=prov_id, @@ -299,9 +302,8 @@ class FunctionToolExecutor(BaseFunctionToolExecutor[AstrAgentContext]): system_prompt=tool.agent.instructions, tools=toolset, contexts=contexts, - max_steps=30, - run_hooks=tool.agent.run_hooks, - stream=ctx.get_config().get("provider_settings", {}).get("stream", False), + max_steps=agent_max_step, + stream=stream, ) yield mcp.types.CallToolResult( content=[mcp.types.TextContent(type="text", text=llm_resp.completion_text)]