Workflows Overview
Workflows provide a powerful node-based execution system for orchestrating complex agent operations with parallel processing, conditional logic, and built-in agent discovery.Core Concepts
Egregore’s workflow system is built on these fundamental concepts:Nodes
Nodes are the building blocks of workflows - callable units that transform data:Sequences
Sequences chain nodes together into execution graphs:Parallel Execution
Parallel nodes execute multiple operations concurrently:Agent Discovery
Native agent discovery lets workflows access and manage agents automatically:Key Features
Node Decorators
@node, @decision, @parallel decorators for quick workflow creationParallel Processing
Execute multiple nodes concurrently with dictionary-based result collection
Conditional Logic
Dynamic routing with
@decision nodes based on runtime conditionsNative Agent Discovery
Built-in agent tracking and management within workflows
Shared State
Cross-node state management with
SharedState and workflow_stateType Safety
Optional type checking with
WorkflowTypeChecker for developmentValidation System
Pre-execution validation with cycle detection and dependency checking
Reporting & Metrics
Built-in performance tracking and execution metrics
Quick Start
Basic Workflow
Parallel Workflow
Workflow with Agents
Workflow Components
1. Node Types
| Type | Decorator | Use Case |
|---|---|---|
| Standard | @node | Data processing, transformations |
| Decision | @decision | Conditional routing, branching logic |
| Parallel | @parallel | Concurrent execution |
| Async | AsyncNode | Async operations |
| Batch | BatchNode | Batch processing |
2. Execution Control
| Component | Purpose |
|---|---|
| Sequence | Chain nodes into workflows |
| WorkflowController | Start/stop/pause workflows |
| SharedState | Cross-node state management |
| workflow_state | Decorator for stateful nodes |
3. Agent Discovery
| Function | Purpose |
|---|---|
get_current_agents() | Get all agents in workflow |
get_current_agent_states() | Get agent states |
interrupt_current_agents() | Stop all agents |
apply_policy_to_current_agents() | Apply policies |
get_agents_in_node() | Get agents in specific node |
4. Validation & Type Checking
| Component | Purpose |
|---|---|
| SequenceValidator | Pre-execution validation |
| CycleDetectionValidator | Detect circular dependencies |
| DependencyValidator | Check node dependencies |
| WorkflowTypeChecker | Type safety checking |
5. Reporting
| Component | Purpose |
|---|---|
| WorkflowMetricsCollector | Collect execution metrics |
| PerformanceSummary | Performance analysis |
| ExecutionStatus | Track execution state |
| ErrorReport | Error tracking |
Common Patterns
ETL Pipeline
Parallel Data Gathering
Conditional Branching
Agent Coordination
Performance Considerations
- Parallel execution: Multiple nodes run concurrently in separate threads
- Resource optimization: Parallel nodes share resources efficiently
- Terminal node collection: Results gathered from all terminal nodes
- Agent discovery overhead: Less than 1ms per node
- Type checking: Disabled by default for production (enable for development)
Error Handling
Workflows provide comprehensive error handling:What’s Next?
Creating Nodes
Learn to create workflow nodes
Parallel Execution
Execute nodes concurrently
Agent Discovery
Access and manage agents in workflows
Shared State
Share state across nodes
Validation
Validate workflows before execution
Type Safety
Type checking for workflows
Reporting
Track workflow performance
Best Practices
Workflow design patterns

