Hi everyone,
I’ve noticed an issue when using Process.hierarchical
in my crew setup. Specifically, when I define a manager_agent
along with other agents, only the manager agent gets added to self.agents
[I confirmed this by adding logging and debugging — the coworker agents never appear in self.agents
]. Because of this, when the manager tries to delegate tasks to coworkers, it can’t find the other agents and ends up taking over the task itself.
Is this the expected behavior of Process.hierarchical
, or am I missing something in my configuration?
Here’s a simplified version of my crew.py
:
from crewai import Agent, Crew, Process, Taskfrom crewai.project import CrewBase, agent, crew, taskimport loggingfrom langchain_openai import ChatOpenAI
@CrewBaseclass
FormWorkflowCreationCrew():
“”“Workflow creation crew for handling form submissions and validations”“”
tasks_config = 'config/formWorkflowTasks.yaml'
manager_llm = ChatOpenAI(
model="gpt-4.1-mini",
temperature=0.2
)
def __init__(self):
super().__init__()
# Configure debug logging for this crew
self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")
self.logger.setLevel(logging.DEBUG)
# -------------------- Agents --------------------
@agent
def manager_agent(self) -> Agent:
return Agent(
role="Form Manager Agent",
goal=(
"Decide which specialized agent should handle the form-related task "
"based on the type of request (validation, compliance, storage). "
"Route the request correctly to ensure the workflow runs smoothly."
),
backstory=(
"You are an experienced workflow manager who understands form validation, "
"business rules, and compliance requirements. You don’t perform tasks directly, "
"but you delegate to specialized agents."
),
llm=self.manager_llm
)
@agent
def form_validator_agent(self) -> Agent:
return Agent(
role="Form Validator Agent",
goal=(
"Validate user-submitted forms by checking required fields, "
"data formats, and consistency rules."
),
backstory=(
"You are a data validation specialist. You ensure forms are complete, "
"well-structured, and error-free before further processing."
),
)
@agent
def policy_agent(self) -> Agent:
return Agent(
role="Policy Compliance Agent",
goal=(
"Check whether the submitted forms comply with business policies "
"and regulatory standards."
),
backstory=(
"You are a compliance expert. You review forms against business rules "
"and regulations to ensure correctness and legal alignment."
),
)
# -------------------- Task --------------------
@task
def form_workflow_task(self) -> Task:
return Task(
config=self.tasks_config["form_workflow_task"],
)
# -------------------- Crew --------------------
@crew
def crew(self) -> Crew:
self.logger.debug("Initializing FormWorkflowCreationCrew with debug logging enabled")
agents = [self.form_validator_agent(), self.policy_agent()]
return Crew(
manager_agent=self.manager_agent(),
agents=agents,
tasks=[self.form_workflow_task()],
process=Process.hierarchical,
manager_llm=self.manager_llm,
verbose=True,
)
Has anyone else run into this behavior? Shouldn’t the coworker agents (form_validator_agent
, policy_agent
) also be accessible to the manager in hierarchical mode?
Expected Behavior
-
The
manager_agent
should appear inself.agents
alongside coworker agents (form_validator_agent
,policy_agent
). -
When delegating, the manager should be able to route tasks to those coworkers.
-
Manager should only handle tasks itself if explicitly instructed or no suitable coworker exists.
Actual Behavior
-
Only the
manager_agent
is present inself.agents
. -
Coworker agents are not included, so delegation fails.
-
As a result, the
manager_agent
ends up executing the tasks itself instead of delegating.
Thanks in advance!