mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-07 10:12:38 +00:00
The two parallel agent-executor implementations (CrewAgentExecutor and
the experimental AgentExecutor) had drifted enough that the Agent class
silently routed kickoff() and execute_task() to different executors:
* Agent.execute_task() instantiated self.executor_class (default
CrewAgentExecutor).
* Agent.kickoff() hard-coded AgentExecutor, ignoring executor_class.
* The reasoning-gate guard 'self.executor_class is not AgentExecutor'
coupled feature behavior to literal class identity, so a subclass of
either executor that opted into / out of internal planning was
handled incorrectly.
This patch introduces two ClassVar capability flags on
BaseAgentExecutor:
* supports_internal_planning - whether the executor runs its own
planning/replanning loop (and therefore should NOT have the external
handle_reasoning step run before task execution).
* supports_kickoff - whether the executor implements the Flow-based
kickoff entry point.
AgentExecutor sets both to True; CrewAgentExecutor leaves both False.
The Agent class now consults these flags instead of testing class
identity:
* The reasoning gate is 'not getattr(executor_class,
supports_internal_planning, False)'.
* Agent.kickoff() routes through _resolve_kickoff_executor_class()
which honors executor_class when it advertises supports_kickoff and
otherwise emits a DeprecationWarning before falling back to
AgentExecutor for backwards compatibility.
A new test module
lib/crewai/tests/agents/test_executor_consistency.py pins down the
contract.
Co-Authored-By: João <joao@crewai.com>