I'm trying to build a hierarchical crew where one manager agent oversees three specialists. I'm worried about the token costs and the manager getting stuck in a loop. For someone without a formal crewai certification, are there specific guardrails I should implement to keep the agents on track and prevent the manager from delegating the same task indefinitely?
3 answers
The hierarchical process is where CrewAI really shines for startups that need oversight. To avoid the loops you mentioned, you should always set a max_rpm (requests per minute) and use the max_iter parameter in your agent configuration. Without these, a manager might "over-think" a simple task. Also, make sure your manager agent uses a high-reasoning model like GPT-4o, while your workers can use cheaper models like Llama 3 or Haiku. This "asymmetric" model usage is a key strategy often taught in crewai certification modules to balance high-level intelligence with cost-efficiency in a production environment.
Is there a way to force the manager to ask for human approval before it moves on to a high-cost task?
I recommend starting with a sequential process first. It's much easier to debug than a hierarchical one when you're just starting.
Good point, Laura. Crawl, walk, then run! Mastering the sequential flow is the first step toward that crewai certification expertise.
Yes, Matthew! You can use the human_input flag on a specific task. The crew will pause and wait for your confirmation. This is a lifesaver when you’re building your crewai certification skills and aren't 100% sure of the logic yet.