/ examples / yaml / agents_workflow.yaml
agents_workflow.yaml
  1  # Extended agents.yaml with Workflow Patterns
  2  # This file demonstrates the extended agents.yaml format that supports
  3  # advanced workflow patterns while maintaining backward compatibility.
  4  #
  5  # Usage: praisonai agents_workflow.yaml
  6  #
  7  # Key differences from standard agents.yaml:
  8  # - process: workflow (triggers workflow mode)
  9  # - workflow: section for planning, reasoning, memory
 10  # - steps: section for workflow patterns (route, parallel, loop, repeat)
 11  
 12  framework: praisonai
 13  process: workflow
 14  input: "Research AI trends and create a comprehensive report"  # The input passed to {{input}} in steps
 15  
 16  # Workflow configuration (new)
 17  workflow:
 18    planning: true
 19    reasoning: true
 20    verbose: true
 21    memory:
 22      backend: chroma
 23  
 24  # Variables for template substitution
 25  variables:
 26    topic: AI trends
 27    topics:
 28      - Machine Learning
 29      - Neural Networks
 30      - Natural Language Processing
 31  
 32  # Agent definitions using familiar 'roles' format
 33  agents:  # Canonical: use 'agents' instead of 'roles'
 34    classifier:
 35      role: Request Classifier
 36      instructions: | # Canonical
 37        You are an expert at classifying requests into categories.
 38        Respond with ONLY one word: 'technical', 'creative', or 'research'.
 39      goal: Classify incoming requests accurately
 40      
 41    researcher:
 42      role: Research Analyst
 43      instructions: | # Canonical
 44        You are a skilled research analyst with expertise in technology trends.
 45        You provide concise, factual research findings with citations.
 46      goal: Research topics thoroughly and provide insights
 47      tools:
 48        - tavily_search
 49      llm:
 50        model: gpt-4o-mini
 51        
 52    tech_expert:
 53      role: Technical Expert
 54      instructions: | # Canonical
 55        You are a technical expert with deep knowledge in AI and ML.
 56        You provide detailed technical explanations.
 57      goal: Handle technical questions with expertise
 58      
 59    creative_writer:
 60      role: Creative Writer
 61      instructions: | # Canonical
 62        You are a creative writer who can make complex topics engaging.
 63        You write in a clear, accessible style.
 64      goal: Create engaging content from research
 65      
 66    market_analyst:
 67      role: Market Analyst
 68      instructions: | # Canonical
 69        You analyze market trends and competitive landscapes.
 70        You provide actionable business insights.
 71      goal: Analyze market trends and opportunities
 72      
 73    aggregator:
 74      role: Synthesizer
 75      instructions: | # Canonical
 76        You combine findings from multiple sources into coherent reports.
 77        You identify patterns and key insights.
 78      goal: Synthesize all findings into comprehensive reports
 79  
 80  # Workflow steps with patterns (new)
 81  steps:
 82    # Step 1: Classify the request
 83    - agent: classifier
 84      action: "Classify this request: {{topic}}"
 85      
 86    # Step 2: Route to appropriate handler based on classification
 87    - name: routing
 88      route:
 89        technical: [tech_expert]
 90        creative: [creative_writer]
 91        default: [researcher]
 92        
 93    # Step 3: Parallel research on multiple aspects
 94    - name: parallel_research
 95      parallel:
 96        - agent: researcher
 97          action: "Research technology trends for {{topic}}"
 98        - agent: market_analyst
 99          action: "Analyze market opportunities for {{topic}}"
100          
101    # Step 4: Loop over specific topics
102    - agent: researcher
103      action: "Deep dive into {{item}}"
104      loop:
105        over: topics
106        
107    # Step 5: Aggregate all findings
108    - agent: aggregator
109      action: "Synthesize all research findings into a comprehensive report"
110      repeat:
111        until: "comprehensive"
112        max_iterations: 2
113  
114  # Optional callbacks
115  callbacks:
116    on_step_complete: log_step