From a893e6030bfa3e7863d1076787651184b1a0d6a3 Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Tue, 22 Jul 2025 10:21:31 -0400 Subject: [PATCH] fix: handle None agent_executor and type mismatch - Add None check before accessing agent_executor attributes - Convert task.human_input to bool for type compatibility --- src/crewai/agent.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/crewai/agent.py b/src/crewai/agent.py index 6cee78706..f839df504 100644 --- a/src/crewai/agent.py +++ b/src/crewai/agent.py @@ -547,12 +547,17 @@ class Agent(BaseAgent): Returns: The output of the agent. """ + if not self.agent_executor: + raise ValueError( + "Agent executor not initialized. Call create_agent_executor() first." + ) + return self.agent_executor.invoke( { "input": task_prompt, "tool_names": self.agent_executor.tools_names, "tools": self.agent_executor.tools_description, - "ask_for_human_input": task.human_input, + "ask_for_human_input": bool(task.human_input), } )["output"]