mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-07 19:48:13 +00:00
When CrewAgentExecutor is reused across sequential tasks, the messages list and iterations counter were not cleared between invocations. This caused: - Duplicate system/user messages accumulating across tasks - Iterations counter not resetting, triggering premature max-iteration exits - Context pollution where Task N sees messages from Tasks 1..N-1 The fix resets self.messages and self.iterations at the beginning of both invoke() and ainvoke(), matching the behavior of the experimental AgentExecutor which already correctly resets state. Fixes #4319, #4389, #4661 Co-Authored-By: João <joao@crewai.com>