From 07bb1647588a781e701257c4c379736537029ea0 Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Tue, 30 Dec 2025 13:39:09 -0800 Subject: [PATCH] fix: Exclude thought parts when merging agent output PiperOrigin-RevId: 850500329 --- src/google/adk/tools/agent_tool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/google/adk/tools/agent_tool.py b/src/google/adk/tools/agent_tool.py index 46d86166..799f0ea4 100644 --- a/src/google/adk/tools/agent_tool.py +++ b/src/google/adk/tools/agent_tool.py @@ -188,7 +188,9 @@ class AgentTool(BaseTool): if not last_content: return '' - merged_text = '\n'.join(p.text for p in last_content.parts if p.text) + merged_text = '\n'.join( + p.text for p in last_content.parts if p.text and not p.thought + ) if isinstance(self.agent, LlmAgent) and self.agent.output_schema: tool_result = self.agent.output_schema.model_validate_json( merged_text