Process
TheProcess
class provides sophisticated task orchestration capabilities for multi-agent systems, supporting sequential, workflow, and hierarchical execution patterns with advanced features like loops, conditions, and validation feedback.
Overview
The Process module orchestrates how tasks are executed across multiple agents, managing dependencies, context sharing, retries, and complex workflows. It provides three main execution modes, each suited for different use cases.Basic Usage
Execution Modes
Sequential Process
Executes tasks one after another in a linear fashion.Workflow Process
Supports complex task relationships with conditions, loops, and dynamic routing.Hierarchical Process
Uses a manager agent to dynamically coordinate task execution.Advanced Features
Loop Task Processing
Process batches of data from CSV or text files:Decision Tasks and Routing
Implement conditional workflows based on task outputs:Validation Feedback and Retry
Handle task failures with intelligent retry mechanisms:Context Management
Share information between tasks efficiently:Async Execution
All process types support asynchronous execution:Configuration Options
Process Parameters
- tasks (Dict[str, Task]): Dictionary mapping task IDs to Task objects
- agents (List[Agent]): Available agents for task execution
- manager_llm (str, optional): LLM for hierarchical manager agent
- verbose (bool): Enable detailed logging
- max_iter (int): Maximum iterations for workflow execution (default: 10)
Task States
Tasks progress through these states:- pending: Not yet started
- in_progress: Currently executing
- completed: Successfully finished
- failed: Execution failed
- skipped: Skipped due to conditions
- retrying: Failed but retrying
Best Practices
-
Choose the Right Mode:
- Sequential: Simple pipelines, predictable workflows
- Workflow: Complex logic, conditions, loops
- Hierarchical: Dynamic orchestration, adaptive workflows
-
Handle Failures Gracefully:
-
Optimize Context Sharing:
-
Monitor Progress:
Integration Example
See Also
- Task Configuration - Task setup and options
- Agent Documentation - Agent capabilities
- Workflow Examples - Real-world workflows
- Process Concepts - Conceptual overview