From e2d973fe3f3269a6c8d00eb5f867e67106e68254 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Sat, 11 Apr 2026 15:51:39 +0200 Subject: [PATCH] Remove agent stalled feature Remove MaxSteps limit and associated stalled event emission. The agent will now run indefinitely until completion or interruption, eliminating the annoying 'agent stalled' messages. --- pkg/agent/core.go | 1 - pkg/agent/loop.go | 20 ++++---------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/pkg/agent/core.go b/pkg/agent/core.go index 9201573..ebf3801 100644 --- a/pkg/agent/core.go +++ b/pkg/agent/core.go @@ -244,7 +244,6 @@ func NewAgentCore(cfg AgentCoreConfig) Core { systemPrompt: cfg.Env.systemPrompt, Tools: cfg.Env.tools, Exec: cfg.Env.exec, - MaxSteps: 20, GenerationParams: cfg.Env.genParams, } return &agentCore{ diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index 371c52b..e743245 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -19,7 +19,6 @@ type loopConfig struct { Backend backend.Backend Tools []backend.Tool Exec toolExecutor - MaxSteps int Output EventHandler systemPrompt string GenerationParams backend.GenerationParams @@ -27,15 +26,10 @@ type loopConfig struct { } func run(ctx context.Context, cfg loopConfig, state state) error { - maxSteps := cfg.MaxSteps - if maxSteps <= 0 { - maxSteps = 1 - } - var totalToolCalls int - hitLimit := false + var step int - for step := range maxSteps { + for { history := state.history() if cfg.systemPrompt != "" { history = append([]backend.Message{{Role: "system", Content: cfg.systemPrompt}}, history...) @@ -214,14 +208,8 @@ func run(ctx context.Context, cfg loopConfig, state state) error { } break } - if step >= maxSteps-1 { - hitLimit = true - break - } - } - - if hitLimit { - emit(cfg, Event{Role: "stalled", Content: "max steps"}) + + step++ } return nil