I am trying to build a multi-crew system which will be coordinated by a manager flow, but on running the flow i am getting errors that selected crew is returning a empty crew, i.e no agent or tasks even listed in it let alone user’s input.
pydantic_core.\_pydantic_core.ValidationError: 1 validation error for Crew
Either ‘agents’ and ‘tasks’ need to be set or ‘config’. \[type=missing_keys, input_value={‘agents’: [ ], ‘tasks’: \[…: True, ‘memory’: False}, input_type=dict\]
crew itself is running fine on its own, problem only arises when i try to run it from the flow.
Directory structure is something like this,
Crew’s directory structure is same as default when creating with, crewai create crew1
I am using builtin flows, but the problem is actually related to config paths, since each crew has its own configs in a separate folder than flow.py, because of that crews instantiated in flow.py are not able to access configs. I even tried hardcoding the absolute config path in the crews but i still get the same error.
@Dkain Try this:
When you instantiate crews from your flow, the config paths (config/agents.yaml, config/tasks.yaml) are resolved relative to the crew’s own directory.
Solution:
Ensure each crew uses the @CrewBase decorator - This is required for config loading to work properly.
The config paths in your crew classes should be relative to the crew.py file location, not the flow. The @CrewBase decorator automatically looks for configs beside the class file.
For multi-crew flows, use the recommended project structure:
In your crew classes, keep the default config paths:
@CrewBase
class Crew1:
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
**@CrewBase**looks for config files beside the class file and safely falls back to empty dicts if files are missing (which explains your empty agents/tasks).
Move your crews into a crews/ folder inside your flow project, or ensure the config paths are correctly relative to each crew’s .py file location.