fix(agent): treat end_turn as natural stop

This commit is contained in:
cao_j
2026-07-01 16:16:08 +08:00
committed by lyingbug
parent baada32cb6
commit b16cb0bb56
4 changed files with 66 additions and 18 deletions
+3 -3
View File
@@ -437,9 +437,9 @@ func (e *AgentEngine) callLLMWithRetry(
round, response.FinishReason, len(response.Content))
// Early signal for natural-stop path: this round will be analyzed as a
// likely final answer (no tool call branch).
if response.FinishReason == "stop" {
logger.Infof(ctx, "[Agent][Round-%d] Natural-stop candidate detected (finish=stop, tool_calls=0, content=%d chars)",
round, len(response.Content))
if isNaturalStopFinishReason(response.FinishReason) {
logger.Infof(ctx, "[Agent][Round-%d] Natural-stop candidate detected (finish=%s, tool_calls=0, content=%d chars)",
round, response.FinishReason, len(response.Content))
}
}
if response.Content != "" {