From b6927c9a7af751ef483e3cb7f7009d8b716bd6d4 Mon Sep 17 00:00:00 2001 From: lxowalle <83055338+lxowalle@users.noreply.github.com> Date: Fri, 27 Feb 2026 15:42:47 +0800 Subject: [PATCH] Prompt to modify the max_tool_iterations parameter. (#855) * Prompt to modify the max_tool_iterations parameter. * fix typo and set max iterations to 50 --- pkg/agent/loop.go | 6 ++++-- pkg/config/defaults.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 693f2227b..7c774ff17 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -52,6 +52,8 @@ type processOptions struct { NoHistory bool // If true, don't load session history (for heartbeat) } +const defaultResponse = "I've completed processing but have no response to give. Increase `max_tool_iterations` in config.json." + func NewAgentLoop(cfg *config.Config, msgBus *bus.MessageBus, provider providers.LLMProvider) *AgentLoop { registry := NewAgentRegistry(cfg, provider) @@ -260,7 +262,7 @@ func (al *AgentLoop) ProcessHeartbeat(ctx context.Context, content, channel, cha Channel: channel, ChatID: chatID, UserMessage: content, - DefaultResponse: "I've completed processing but have no response to give.", + DefaultResponse: defaultResponse, EnableSummary: false, SendResponse: false, NoHistory: true, // Don't load session history for heartbeat @@ -326,7 +328,7 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage) Channel: msg.Channel, ChatID: msg.ChatID, UserMessage: msg.Content, - DefaultResponse: "I've completed processing but have no response to give.", + DefaultResponse: defaultResponse, EnableSummary: true, SendResponse: false, }) diff --git a/pkg/config/defaults.go b/pkg/config/defaults.go index cf799140d..6805a8bc4 100644 --- a/pkg/config/defaults.go +++ b/pkg/config/defaults.go @@ -16,7 +16,7 @@ func DefaultConfig() *Config { Model: "glm-4.7", MaxTokens: 8192, Temperature: nil, // nil means use provider default - MaxToolIterations: 20, + MaxToolIterations: 50, }, }, Bindings: []AgentBinding{},