chore(agent): log natural-stop candidate when no tool calls
Add explicit response logging for the branch where the model returns finish=stop with zero tool calls. This makes it easier to identify the natural-stop path early in logs and correlate rounds that are likely to be treated as final-answer candidates by analyzeResponse. - include `tool_calls=0` in the no-tool summary log - emit a dedicated "Natural-stop candidate detected" info log when finish_reason is stop and no tool calls are present
This commit is contained in:
@@ -358,8 +358,14 @@ func (e *AgentEngine) callLLMWithRetry(
|
||||
logger.Infof(ctx, "[Agent][Round-%d] LLM responded: finish=%s, content=%d chars, tools=%v",
|
||||
round, response.FinishReason, len(response.Content), tcNames)
|
||||
} else {
|
||||
logger.Infof(ctx, "[Agent][Round-%d] LLM responded: finish=%s, content=%d chars",
|
||||
logger.Infof(ctx, "[Agent][Round-%d] LLM responded: finish=%s, content=%d chars, tool_calls=0",
|
||||
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 response.Content != "" {
|
||||
preview := response.Content
|
||||
|
||||
Reference in New Issue
Block a user