mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 23:58:34 +00:00
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
This commit is contained in:
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user