From 3405c72b5e8c35f75d70aae519172d2f0045879e Mon Sep 17 00:00:00 2001 From: LIghtJUNction Date: Sat, 21 Mar 2026 04:17:59 +0800 Subject: [PATCH] Modify context configuration parameters Updated max_context_tokens default value and adjusted enforce_max_turns logic. --- astrbot/core/agent/runners/tool_loop_agent_runner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astrbot/core/agent/runners/tool_loop_agent_runner.py b/astrbot/core/agent/runners/tool_loop_agent_runner.py index 89f5ff3ed..db26e37af 100644 --- a/astrbot/core/agent/runners/tool_loop_agent_runner.py +++ b/astrbot/core/agent/runners/tool_loop_agent_runner.py @@ -125,9 +125,9 @@ class ToolLoopAgentRunner(BaseAgentRunner[TContext]): # TODO: 2. after LLM output a tool call self.context_config = ContextConfig( # <=0 will never do compress - max_context_tokens=provider.provider_config.get("max_context_tokens", 0), + max_context_tokens=provider.provider_config.get("max_context_tokens", 4096), # enforce max turns before compression - enforce_max_turns=self.enforce_max_turns, + enforce_max_turns=self.enforce_max_turns if self.enforce_max_turns != -1 else 15,, truncate_turns=self.truncate_turns, llm_compress_instruction=self.llm_compress_instruction, llm_compress_keep_recent=self.llm_compress_keep_recent,