If you've instantiated your CrewAI Crew as a class, using the convenient decorators (@agent
, @task
, for example) as shown in the documentation you probably ended up with something like this:
@crew
def crew(self) -> Crew:
"""Creates the crew"""
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
full_output=True,
verbose=2,
)
The docs seem to indicate that you can just swap out Process.hierarchical
for Process.sequential
and be fine. But you cannot. You need to do the following:
- Add the
manager_agent
as an instance of the manager agent. - Define the agents as the list of non-manager agents, here I just did my
researcher
andreporting_analyst
- Make sure you instantiate them
self.researcher()
notself.researcher
. Do the same for themanager_agent
.
@crew
def crew(self) -> Crew:
"""Creates the crew"""
return Crew(
agents=[self.researcher(), self.reporting_analyst()],
tasks=self.tasks,
manager_agent=self.coordinator(),
process=Process.hierarchical,
full_output=True,
verbose=2,
)
This is useful information.