Updated Managing Processes (markdown)

João Moura
2023-11-14 10:25:04 -03:00
parent decd7e26a0
commit c939b582a7

@@ -1,45 +1,48 @@
# Managing Processes in CrewAI
Processes in CrewAI are the orchestrators of workflow, defining how tasks are assigned and handled by agents. They are the rules and patterns that determine the operational flow of the crew, enabling complex, multi-agent systems to function with harmony and efficiency.
Processes are the heart of CrewAI's workflow management, akin to the way a human team organizes its work. In CrewAI, processes define the sequence and manner in which tasks are executed by agents, mirroring the coordination you'd expect in a well-functioning team of people.
## What is a Process?
## Understanding Processes
In CrewAI, a process is like a playbook that tells agents not just what to do, but how to do it. It's a set of instructions that guides the behavior of the crew, ensuring tasks are performed in an orderly and effective manner.
A process in CrewAI can be thought of as the game plan for how your AI agents will handle their workload. Just as a project manager assigns tasks to team members based on their skills and the project timeline, CrewAI processes assign tasks to agents to ensure efficient workflow.
## Types of Processes
## Currently Supported Processes
CrewAI supports several types of processes:
- **Sequential (Supported)**: This is the only process currently implemented in CrewAI. It ensures tasks are handled one at a time, in a given order, much like a relay race where one runner passes the baton to the next.
- **Sequential**: Tasks are performed one after the other, in a specific order.
- **Parallel**: Multiple tasks are performed at the same time, by different agents.
- **Conditional**: Tasks are performed based on certain conditions or the outcomes of previous tasks.
## Future Process Implementations (WIP)
## Defining a Process
- **Parallel (WIP)**: Planned for future updates, this will allow multiple tasks to be carried out simultaneously by different agents, similar to various team members working on their assignments concurrently.
- **Conditional (WIP)**: Also planned for future updates, conditional processes will enable tasks to be executed based on specific conditions or outcomes, akin to decision-making in team meetings.
A process is defined by creating a `Process` object. This object can then be assigned to a crew to dictate how it manages its tasks.
## Defining a Sequential Process
Creating a sequential process in CrewAI is straightforward and reflects the simplicity of coordinating a team's efforts step by step.
```python
from crewai import Process
# Define a sequential process
sequential_process = Process.sequential
```
The Magic of Sequential Processes
The sequential process is where much of CrewAI's magic happens. It ensures that tasks are approached with the same thoughtful progression that a human team would use, fostering a natural and logical flow of work.
# Define a parallel process (when implemented)
# parallel_process = Process.parallel
## Assigning Processes to a Crew
To assign a process to a crew, simply set it during the crew's creation. The process will dictate the crew's approach to task execution.
```python
from crewai import Crew
# Create a crew with a sequential process
crew = Crew(agents=my_agents, tasks=my_tasks, process=sequential_process)
```
## Process Execution
## The Role of Processes in Teamwork
When a crew begins work with the kickoff method, it follows the assigned process. The crew's process manages which tasks are active at any given time, which agents are working on them, and what happens once tasks are completed.
## Advantages of Process Management
By managing processes, CrewAI allows for:
- Scalability: Easily manage a large number of tasks and agents.
- Flexibility: Adjust the flow of operations as the project evolves.
- Efficiency: Maximize the productivity of agents by optimizing the order and manner in which tasks are executed.
The process you choose for your crew is critical. It's what transforms a group of individual agents into a cohesive unit that can tackle complex projects with the precision and harmony you'd find in a team of skilled humans.
## Conclusion
Processes are central to the CrewAI framework, providing the structure needed for agents to function cohesively. With a clear understanding of processes, you can design systems that are both robust and adaptable, capable of tackling simple tasks and complex workflows alike.
Processes bring structure and order to the CrewAI ecosystem, allowing agents to collaborate effectively and accomplish goals systematically. As CrewAI evolves, additional process types will be introduced to enhance the framework's versatility, much like a team that grows and adapts over time.