Skip to content

Commit 07bb164

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: Exclude thought parts when merging agent output
PiperOrigin-RevId: 850500329
1 parent a364388 commit 07bb164

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/google/adk/tools/agent_tool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ async def run_async(
188188

189189
if not last_content:
190190
return ''
191-
merged_text = '\n'.join(p.text for p in last_content.parts if p.text)
191+
merged_text = '\n'.join(
192+
p.text for p in last_content.parts if p.text and not p.thought
193+
)
192194
if isinstance(self.agent, LlmAgent) and self.agent.output_schema:
193195
tool_result = self.agent.output_schema.model_validate_json(
194196
merged_text

0 commit comments

Comments
 (0)