fix: Exclude thought parts when merging agent output

PiperOrigin-RevId: 850500329
This commit is contained in:
Google Team Member
2025-12-30 13:39:09 -08:00
committed by Copybara-Service
parent a364388d97
commit 07bb164758
+3 -1
View File
@@ -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