From 96fea29a33cf3d2ed2f46af72ce83c6e76d67022 Mon Sep 17 00:00:00 2001 From: afjcjsbx Date: Sat, 21 Feb 2026 17:56:59 +0100 Subject: [PATCH] log debug llm response --- pkg/agent/loop.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/agent/loop.go b/pkg/agent/loop.go index add183aaf..e979039c2 100644 --- a/pkg/agent/loop.go +++ b/pkg/agent/loop.go @@ -532,6 +532,23 @@ func (al *AgentLoop) runLLMIteration(ctx context.Context, agent *AgentInstance, break } + if response != nil { + respString := func() string { + b, err := json.MarshalIndent(response, "", " ") + if err != nil { + return fmt.Sprintf("[Error in parsing response: %v]", err) + } + return string(b) + }() + + logger.DebugCF("agent", "Full LLM response", + map[string]interface{}{ + "agent_id": agent.ID, + "iteration": iteration, + "content": respString, + }) + } + errMsg := strings.ToLower(err.Error()) isContextError := strings.Contains(errMsg, "token") || strings.Contains(errMsg, "context") ||