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.
This commit is contained in:
Levi Neely 2026-04-11 15:51:39 +02:00
parent a721439e01
commit e2d973fe3f
2 changed files with 4 additions and 17 deletions

View File

@ -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{

View File

@ -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