Skip to content

Workflows

Workflows dictate how Tasks are executed within a Crew. They define the order, logic, and decision-making structure.

Defines the method by which tasks are executed within a Crew.

Source code in fsdk/anote-sdk.py
class Workflow:
    """
    Defines the method by which tasks are executed within a Crew.
    """

    def __init__(
        self,
        workflow_type: str = "sequential",
        manager_agent: Optional[Agent] = None,
        allow_parallel: bool = False
    ):
        """
        Args:
            workflow_type (str): e.g., 'sequential', 'hierarchical', or 'parallel'.
            manager_agent (Agent, optional): Used in hierarchical workflows.
            allow_parallel (bool): If True, tasks may run concurrently.
        """
        self.workflow_type = workflow_type
        self.manager_agent = manager_agent
        self.allow_parallel = allow_parallel

    def __repr__(self):
        return (f"<Workflow type={self.workflow_type} "
                f"manager_agent={self.manager_agent} "
                f"allow_parallel={self.allow_parallel}>")

__init__(workflow_type='sequential', manager_agent=None, allow_parallel=False)

Parameters:

Name Type Description Default
workflow_type str

e.g., 'sequential', 'hierarchical', or 'parallel'.

'sequential'
manager_agent Agent

Used in hierarchical workflows.

None
allow_parallel bool

If True, tasks may run concurrently.

False
Source code in fsdk/anote-sdk.py
def __init__(
    self,
    workflow_type: str = "sequential",
    manager_agent: Optional[Agent] = None,
    allow_parallel: bool = False
):
    """
    Args:
        workflow_type (str): e.g., 'sequential', 'hierarchical', or 'parallel'.
        manager_agent (Agent, optional): Used in hierarchical workflows.
        allow_parallel (bool): If True, tasks may run concurrently.
    """
    self.workflow_type = workflow_type
    self.manager_agent = manager_agent
    self.allow_parallel = allow_parallel

Description: Workflows define how Tasks are executed within a Crew. Common patterns include:

Workflows Fields

  • workflow_type: e.g., "sequential", "hierarchical", or "parallel".
  • manager_agent: Used in hierarchical workflows (Agent object, optional).
  • allow_parallel: If True, tasks may run concurrently.

Example 1:

workflow_example = {
    "workflow_type": "sequential",
    "manager_agent": None,
    "allow_parallel": False
}

Common Workflow Types

  • Sequential: Tasks run one after another in a predefined order. Good for simple, linear processes.

  • Hierarchical: Involves a "manager" agent that oversees or delegates Tasks to subordinate agents. Useful when tasks must be dynamically created or delegated.

  • Consensual (Planned): Focuses on collaborative decision-making among agents. Agents vote or debate to reach a consensus.

Example 2:

crew = Crew(
    agents=[manager_agent, worker_agent],
    tasks=[task1, task2],
    verbose=True
)

# For hierarchical, specify a manager agent with special logic
crew.workflow_type = "hierarchical"