Files
crewAI/lib
Devin AI 23bc9aa9fa fix: reset executor messages and iterations between task executions
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>
2026-03-01 14:07:16 +00:00
..
2026-02-27 09:44:47 -05:00