From ec20d72aba535292def7376b36dc208218ea479f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 12 Jan 2026 09:07:23 -0800 Subject: [PATCH] LLMAssistantAggregator: reset aggregation after adding the thought, not before --- src/pipecat/processors/aggregators/llm_response_universal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pipecat/processors/aggregators/llm_response_universal.py b/src/pipecat/processors/aggregators/llm_response_universal.py index c47579fba..1baf87304 100644 --- a/src/pipecat/processors/aggregators/llm_response_universal.py +++ b/src/pipecat/processors/aggregators/llm_response_universal.py @@ -950,7 +950,6 @@ class LLMAssistantAggregator(LLMContextAggregator): return thought = concatenate_aggregated_text(self._thought_aggregation) - await self._reset_thought_aggregation() if self._thought_append_to_context: llm = self._thought_llm @@ -966,6 +965,9 @@ class LLMAssistantAggregator(LLMContextAggregator): ) message = AssistantThoughtMessage(content=thought, timestamp=self._thought_start_time) + + await self._reset_thought_aggregation() + await self._call_event_handler("on_assistant_thought", message) def _context_updated_task_finished(self, task: asyncio.Task):