fix: Filter out thought parts when saving agent output to state

PiperOrigin-RevId: 809270320
This commit is contained in:
Google Team Member
2025-09-19 18:58:11 -07:00
committed by Copybara-Service
parent 6e834d3fac
commit 632bf8b0bc
+3 -1
View File
@@ -515,7 +515,9 @@ class LlmAgent(BaseAgent):
):
result = ''.join(
[part.text if part.text else '' for part in event.content.parts]
part.text
for part in event.content.parts
if part.text and not part.thought
)
if self.output_schema:
# If the result from the final chunk is just whitespace or empty,