/ examples / yaml / workflows / complete_workflow.yaml
complete_workflow.yaml
  1  # Complete Workflow Example
  2  # Demonstrates all workflow patterns in a single comprehensive workflow
  3  
  4  name: Complete Research Workflow
  5  description: A comprehensive workflow demonstrating all patterns - route, parallel, loop, repeat
  6  framework: praisonai
  7  
  8  workflow:
  9    planning: true
 10    reasoning: true
 11    verbose: true
 12    memory_config:
 13      provider: chroma
 14      persist: true
 15  
 16  variables:
 17    topic: AI trends
 18    topics:
 19      - Machine Learning
 20      - Neural Networks
 21      - Natural Language Processing
 22  
 23  agents:
 24    classifier:
 25      name: Classifier
 26      role: Request Classifier
 27      goal: Classify incoming requests
 28      instructions: |
 29        Classify the request. Respond with ONLY one word:
 30        - 'technical' for technical questions
 31        - 'creative' for creative requests
 32        - 'research' for research tasks
 33  
 34    researcher:
 35      name: Researcher
 36      role: Research Analyst
 37      goal: Research topics thoroughly
 38      instructions: "You are a research analyst. Provide concise, factual research findings."
 39  
 40    tech_expert:
 41      name: TechExpert
 42      role: Technical Expert
 43      goal: Handle technical questions
 44      instructions: "You are a technical expert. Provide detailed technical answers."
 45  
 46    creative_writer:
 47      name: CreativeWriter
 48      role: Creative Writer
 49      goal: Handle creative requests
 50      instructions: "You are a creative writer. Write engaging, creative content."
 51  
 52    market_analyst:
 53      name: MarketAnalyst
 54      role: Market Analyst
 55      goal: Analyze market trends
 56      instructions: "You are a market analyst. Provide market insights."
 57  
 58    competitor_analyst:
 59      name: CompetitorAnalyst
 60      role: Competitor Analyst
 61      goal: Analyze competitors
 62      instructions: "You are a competitor analyst. Provide competitive insights."
 63  
 64    aggregator:
 65      name: Aggregator
 66      role: Synthesizer
 67      goal: Combine and synthesize findings
 68      instructions: "You are a synthesizer. Combine all findings into a comprehensive report."
 69  
 70    evaluator:
 71      name: Evaluator
 72      role: Quality Evaluator
 73      goal: Evaluate content quality
 74      instructions: |
 75        Evaluate the content. If it's comprehensive and well-structured, respond with "APPROVED".
 76        Otherwise, provide specific feedback for improvement.
 77  
 78  steps:
 79    # Step 1: Classify the request
 80    - agent: classifier
 81      action: "Classify: {{input}}"
 82      
 83    # Step 2: Route to appropriate handler
 84    - name: routing
 85      route:
 86        technical: [tech_expert]
 87        creative: [creative_writer]
 88        default: [researcher]
 89        
 90    # Step 3: Parallel research
 91    - name: parallel_research
 92      parallel:
 93        - agent: market_analyst
 94          action: "Analyze market for {{topic}}"
 95        - agent: competitor_analyst
 96          action: "Analyze competitors for {{topic}}"
 97          
 98    # Step 4: Loop over topics
 99    - agent: researcher
100      action: "Research {{item}}"
101      loop:
102        over: topics
103        
104    # Step 5: Aggregate findings
105    - agent: aggregator
106      action: "Synthesize all findings into a comprehensive report"
107      
108    # Step 6: Evaluator-optimizer
109    - agent: evaluator
110      action: "Evaluate the report quality"
111      repeat:
112        until: "approved"
113        max_iterations: 2
114  
115  callbacks:
116    on_step_complete: log_step