Skip to content

Commit 632bf8b

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: Filter out thought parts when saving agent output to state
PiperOrigin-RevId: 809270320
1 parent 6e834d3 commit 632bf8b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/google/adk/agents/llm_agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ def __maybe_save_output_to_state(self, event: Event):
515515
):
516516

517517
result = ''.join(
518-
[part.text if part.text else '' for part in event.content.parts]
518+
part.text
519+
for part in event.content.parts
520+
if part.text and not part.thought
519521
)
520522
if self.output_schema:
521523
# If the result from the final chunk is just whitespace or empty,

0 commit comments

Comments
 (0)