Hello CrewAI Community,
I’m encountering a persistent issue with the hierarchical process where the manager agent is unable to delegate tasks to its worker agents, even when configured according to the documentation and community best practices.
The process consistently fails with the error: Error executing tool. coworker mentioned not found, it must be one of the following options: - [manager’s own role]
I’ve created a minimal example to reproduce the issue.
Architecture Overview
The goal is to have a project_manager agent delegate a writing task to a report_writer and then a review task to a report_reviewer.
-
Process: Hierarchical
-
Manager: project_manager
-
Workers: report_writer, report_reviewer
Configuration Files
Here are the simplified configuration files to replicate the problem.
agents.yaml
Generated yaml
# agents.yaml
# Configuration for a simple hierarchical crew.
crew_process: hierarchical
manager_agent: project_manager
agents:
project_manager:
role: "Project Manager"
goal: |
Oversee the creation of a simple report by delegating tasks to your team.
Ensure the report is written and then reviewed before finishing.
# COMMENT: The backstory explicitly lists the team members and their keys,
# which is the recommended workaround for this issue, but it still fails.
backstory: |
You are an efficient project manager.
Your team consists of two specialists:
- A 'report_writer' who is an expert at writing content.
- A 'report_reviewer' who is an expert at proofreading.
You must delegate tasks to them using their exact keys.
verbose: true
allow_delegation: true # Essential for a manager
report_writer:
role: "Content Writer"
goal: "Write a brief, one-paragraph report on a given topic."
backstory: "You are a professional writer known for your concise and clear communication."
verbose: true
allow_delegation: false # Workers do not delegate
report_reviewer:
role: "Content Reviewer"
goal: "Review a report for grammar, clarity, and accuracy."
backstory: "You are a meticulous editor with a keen eye for detail."
verbose: true
allow_delegation: false # Workers do not delegate
content_copydownload
Use code with caution.Yaml
tasks.yaml
Generated yaml
# tasks.yaml
# Defines the single starting task for the manager agent.
manager_kickoff_task:
agent: project_manager
description: |
Your mission is to manage the creation of a report about 'The Importance of Teamwork'.
Your process must be:
1. Delegate a task to the 'report_writer' to write a one-paragraph report on the topic.
2. After the report is written, delegate a task to the 'report_reviewer' to review the writer's work.
3. Once the review is complete, present the final, reviewed report as your final answer.
expected_output: "A final, reviewed one-paragraph report on 'The Importance of Teamwork'."
content_copydownload
Use code with caution.Yaml
The Issue Explained
When this crew is executed, the following happens:
- Expected Behavior:
-
The project_manager should start the manager_kickoff_task.
-
It should successfully use the Delegate work to coworker tool to assign a writing task to the report_writer.
-
After the report_writer completes its task, the manager should delegate a review task to the report_reviewer.
-
Finally, the manager should synthesize the final result.
- Actual Behavior (from the logs):
-
The project_manager starts the task.
-
It correctly identifies that it needs to delegate and calls the Delegate work to coworker tool with coworker: “report_writer”.
-
The tool immediately fails with the error: Error executing tool. coworker mentioned not found, it must be one of the following options: - project_manager.
-
The agent then gets stuck in a loop, trying to delegate again or asking for help, and eventually times out without ever successfully contacting its workers.
Core Problem
The fundamental issue seems to be that the manager’s Delegate work to coworker tool is not being correctly populated with the list of available worker agents (report_writer, report_reviewer). This happens even though:
a) The crew is initialized correctly for a hierarchical process (manager separated from the worker list).
b) The manager’s backstory explicitly lists the worker keys, which is the most common workaround suggested.
Is this a known bug in the current version of CrewAI, or is there a different configuration pattern required to make the manager aware of its team in a hierarchical setup?
Thank you for your help