Skip to main content

cortexai_crew/
process.rs

1//! Process types for crew execution
2
3use serde::{Deserialize, Serialize};
4
5/// Process type for crew execution
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
7pub enum Process {
8    /// Execute tasks one by one in order
9    #[default]
10    Sequential,
11
12    /// Execute tasks in parallel when possible
13    Parallel,
14
15    /// Hierarchical process with manager agent coordinating
16    Hierarchical,
17}
18
19impl Process {
20    pub fn as_str(&self) -> &'static str {
21        match self {
22            Process::Sequential => "sequential",
23            Process::Parallel => "parallel",
24            Process::Hierarchical => "hierarchical",
25        }
26    }
27}
28
29impl std::fmt::Display for Process {
30    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31        write!(f, "{}", self.as_str())
32    }
33}