mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-01 13:18:10 +00:00
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Vulnerability Scan / pip-audit (push) Has been cancelled
Nightly Canary Release / Check for new commits (push) Has been cancelled
Nightly Canary Release / Build nightly packages (push) Has been cancelled
Nightly Canary Release / Publish nightly to PyPI (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
The consensual process was never implemented and is not planned. Removes all mentions across en, ar, ko, and pt-BR locales. Co-authored-by: Lorenze Jay <lorenzejay@users.noreply.github.com> Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
66 lines
3.3 KiB
Plaintext
66 lines
3.3 KiB
Plaintext
---
|
|
title: Processes
|
|
description: Detailed guide on workflow management through processes in CrewAI, with updated implementation details.
|
|
icon: bars-staggered
|
|
mode: "wide"
|
|
---
|
|
|
|
## Overview
|
|
|
|
<Tip>
|
|
Processes orchestrate the execution of tasks by agents, akin to project management in human teams.
|
|
These processes ensure tasks are distributed and executed efficiently, in alignment with a predefined strategy.
|
|
</Tip>
|
|
|
|
## Process Implementations
|
|
|
|
- **Sequential**: Executes tasks sequentially, ensuring tasks are completed in an orderly progression.
|
|
- **Hierarchical**: Organizes tasks in a managerial hierarchy, where tasks are delegated and executed based on a structured chain of command. A manager language model (`manager_llm`) or a custom manager agent (`manager_agent`) must be specified in the crew to enable the hierarchical process, facilitating the creation and management of tasks by the manager.
|
|
|
|
## The Role of Processes in Teamwork
|
|
Processes enable individual agents to operate as a cohesive unit, streamlining their efforts to achieve common objectives with efficiency and coherence.
|
|
|
|
## Assigning Processes to a Crew
|
|
To assign a process to a crew, specify the process type upon crew creation to set the execution strategy. For a hierarchical process, ensure to define `manager_llm` or `manager_agent` for the manager agent.
|
|
|
|
```python
|
|
from crewai import Crew, Process
|
|
|
|
# Example: Creating a crew with a sequential process
|
|
crew = Crew(
|
|
agents=my_agents,
|
|
tasks=my_tasks,
|
|
process=Process.sequential
|
|
)
|
|
|
|
# Example: Creating a crew with a hierarchical process
|
|
# Ensure to provide a manager_llm or manager_agent
|
|
crew = Crew(
|
|
agents=my_agents,
|
|
tasks=my_tasks,
|
|
process=Process.hierarchical,
|
|
manager_llm="gpt-4o"
|
|
# or
|
|
# manager_agent=my_manager_agent
|
|
)
|
|
```
|
|
**Note:** Ensure `my_agents` and `my_tasks` are defined prior to creating a `Crew` object, and for the hierarchical process, either `manager_llm` or `manager_agent` is also required.
|
|
|
|
## Sequential Process
|
|
|
|
This method mirrors dynamic team workflows, progressing through tasks in a thoughtful and systematic manner. Task execution follows the predefined order in the task list, with the output of one task serving as context for the next.
|
|
|
|
To customize task context, utilize the `context` parameter in the `Task` class to specify outputs that should be used as context for subsequent tasks.
|
|
|
|
## Hierarchical Process
|
|
|
|
Emulates a corporate hierarchy, CrewAI allows specifying a custom manager agent or automatically creates one, requiring the specification of a manager language model (`manager_llm`). This agent oversees task execution, including planning, delegation, and validation. Tasks are not pre-assigned; the manager allocates tasks to agents based on their capabilities, reviews outputs, and assesses task completion.
|
|
|
|
## Process Class: Detailed Overview
|
|
|
|
The `Process` class is implemented as an enumeration (`Enum`), ensuring type safety and restricting process values to the defined types (`sequential`, `hierarchical`).
|
|
|
|
## Conclusion
|
|
|
|
The structured collaboration facilitated by processes within CrewAI is crucial for enabling systematic teamwork among agents.
|
|
This documentation has been updated to reflect the latest features and enhancements, ensuring users have access to the most current and comprehensive information. |