mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-06 09:42:39 +00:00
When a Task has an agent assigned but the Crew is built without an explicit agents=[...] list, setup_agents iterates an empty list and never wires agent.crew = crew. Downstream paths that rely on the crew reference (task.prompt() file injection, crew_agent_executor file lookups, delegation tools) then silently no-op, so input_files attached at the Task level are ignored. Add a model_validator that auto-populates Crew.agents with any agent referenced by a task so the crew behaves the same whether agents=[...] is passed explicitly or inferred from tasks, and cover the regression with unit tests. Co-Authored-By: João <joao@crewai.com>