Skip to content

Automation Examples

This guide provides practical examples of Automation Mode configurations for common use cases. Each example includes a complete JSON configuration and explanation of key concepts.

Example 1: Customer Support Ticket Processor

This automation processes support tickets by categorizing them, searching for solutions, and drafting responses.

{
  "tasks": [
    {
      "task_id": "categorize_ticket",
      "description": "Analyze the support ticket and categorize it",
      "candidate_tools": ["ticket_analyzer"],
      "expected_output": "Ticket category and priority level",
      "output_variable_name": "ticket_category",
      "known_arguments": [
        {
          "tool_name": "ticket_analyzer",
          "arguments": [
            {
              "name": "analysis_type",
              "value": "full_categorization"
            }
          ]
        }
      ]
    },
    {
      "task_id": "search_knowledge_base",
      "description": "Search for relevant solutions in the knowledge base",
      "candidate_tools": ["kb_search"],
      "dependencies": [
        {
          "task_id": "categorize_ticket",
          "required_status": "completed"
        }
      ],
      "expected_output": "List of relevant KB articles",
      "output_variable_name": "kb_articles",
      "known_arguments": [
        {
          "tool_name": "kb_search",
          "arguments": [
            {
              "name": "category",
              "value": {
                "name": "$$ticket_category$$"
              }
            },
            {
              "name": "limit",
              "value": 5
            }
          ]
        }
      ]
    },
    {
      "task_id": "draft_response",
      "description": "Draft a customer response using the KB articles",
      "candidate_tools": ["response_generator"],
      "dependencies": [
        {
          "task_id": "search_knowledge_base",
          "required_status": "completed"
        }
      ],
      "expected_output": "Professional customer response",
      "output_variable_name": "draft_response",
      "output_template": "Subject: [SUBJECT]\n\nDear Customer,\n\n[RESPONSE_BODY]\n\nBest regards,\nSupport Team"
    }
  ],
  "variables_required_to_final_answer": ["draft_response", "ticket_category"],
  "version": "1.0"
}

Key Concepts Demonstrated

  • Sequential Dependencies: Each task waits for the previous one
  • Dynamic Variables: $$ticket_category$$ passes data between tasks
  • Output Templates: Structured formatting for the response
  • Known Arguments: Pre-configured values for consistent behavior

Example 2: Data Pipeline with Analysis

This automation extracts data, transforms it, and generates insights.

{
  "tasks": [
    {
      "task_id": "extract_sales_data",
      "description": "Extract sales data from the database",
      "candidate_tools": ["database_query"],
      "expected_output": "Raw sales data in JSON format",
      "output_variable_name": "raw_sales_data",
      "known_arguments": [
        {
          "tool_name": "database_query",
          "arguments": [
            {
              "name": "query",
              "value": "SELECT * FROM sales WHERE date >= CURRENT_DATE - INTERVAL '30 days'"
            },
            {
              "name": "format",
              "value": "json"
            }
          ]
        }
      ]
    },
    {
      "task_id": "transform_data",
      "description": "Clean and transform the sales data",
      "candidate_tools": ["data_transformer"],
      "dependencies": [
        {
          "task_id": "extract_sales_data"
        }
      ],
      "expected_output": "Cleaned data with calculated metrics",
      "output_variable_name": "transformed_data"
    },
    {
      "task_id": "analyze_trends",
      "description": "Analyze sales trends and patterns",
      "candidate_tools": ["trend_analyzer", "statistical_tools"],
      "dependencies": [
        {
          "task_id": "transform_data"
        }
      ],
      "expected_output": "Trend analysis with key insights",
      "output_variable_name": "trend_analysis",
      "runs_react_loop": true,
      "requires_analysis": true,
      "result_evaluation": "Ensure analysis includes: top products, growth rates, seasonal patterns"
    },
    {
      "task_id": "generate_report",
      "description": "Create executive summary report",
      "candidate_tools": ["report_generator"],
      "dependencies": [
        {
          "task_id": "analyze_trends"
        }
      ],
      "expected_output": "Executive summary with visualizations",
      "output_variable_name": "final_report"
    }
  ],
  "variables_required_to_final_answer": ["final_report", "trend_analysis"],
  "constraints": [
    "All data must be from the last 30 days",
    "Report must be suitable for executive presentation"
  ],
  "version": "1.0"
}

Key Concepts Demonstrated

  • React Loop: analyze_trends uses multiple tools iteratively
  • Result Evaluation: Specific criteria for analysis quality
  • Constraints: Global rules for the automation
  • Multiple Tools: Tasks can access multiple tools when needed

Example 3: Multi-Agent Workflow

This example shows how to coordinate multiple specialized agents (requires Magent task type).

{
  "tasks": [
    {
      "task_id": "research_topic",
      "description": "Research the given topic thoroughly",
      "candidate_agents": ["research_agent"],
      "expected_output": "Comprehensive research findings",
      "output_variable_name": "research_findings"
    },
    {
      "task_id": "fact_check",
      "description": "Verify the accuracy of research findings",
      "candidate_agents": ["fact_checker_agent"],
      "dependencies": [
        {
          "task_id": "research_topic"
        }
      ],
      "expected_output": "Fact-checked information with sources",
      "output_variable_name": "verified_facts",
      "known_arguments": [
        {
          "tool_name": "fact_checker_agent",
          "arguments": [
            {
              "name": "content",
              "value": {
                "name": "$$research_findings$$"
              }
            },
            {
              "name": "verification_level",
              "value": "strict"
            }
          ]
        }
      ]
    },
    {
      "task_id": "write_article",
      "description": "Write an article based on verified facts",
      "candidate_agents": ["writer_agent"],
      "dependencies": [
        {
          "task_id": "fact_check"
        }
      ],
      "expected_output": "Well-written article with citations",
      "output_variable_name": "article_draft"
    },
    {
      "task_id": "review_and_edit",
      "description": "Review and edit the article for quality",
      "candidate_agents": ["editor_agent"],
      "dependencies": [
        {
          "task_id": "write_article"
        }
      ],
      "expected_output": "Polished, publication-ready article",
      "output_variable_name": "final_article",
      "pause_and_replan": true
    }
  ],
  "variables_required_to_final_answer": ["final_article"],
  "version": "1.0"
}

Key Concepts Demonstrated

  • Agent Coordination: Multiple specialized agents working together
  • Pause and Replan: Review point before final editing
  • Information Flow: Research → Verification → Writing → Editing

Example 4: API Integration Workflow

This automation integrates multiple APIs to synchronize data.

{
  "tasks": [
    {
      "task_id": "fetch_crm_contacts",
      "description": "Fetch new contacts from CRM system",
      "candidate_tools": ["crm_api"],
      "expected_output": "List of new contacts with details",
      "output_variable_name": "new_contacts",
      "known_arguments": [
        {
          "tool_name": "crm_api",
          "arguments": [
            {
              "name": "endpoint",
              "value": "/contacts/new"
            },
            {
              "name": "since",
              "value": "24h"
            }
          ]
        }
      ]
    },
    {
      "task_id": "validate_contacts",
      "description": "Validate contact information and check for duplicates",
      "candidate_tools": ["data_validator", "duplicate_checker"],
      "dependencies": [
        {
          "task_id": "fetch_crm_contacts"
        }
      ],
      "expected_output": "Validated contacts with duplicate flags",
      "output_variable_name": "validated_contacts",
      "runs_react_loop": true
    },
    {
      "task_id": "sync_to_marketing",
      "description": "Sync validated contacts to marketing platform",
      "candidate_tools": ["marketing_api"],
      "dependencies": [
        {
          "task_id": "validate_contacts"
        }
      ],
      "expected_output": "Sync results with success/failure counts",
      "output_variable_name": "sync_results"
    },
    {
      "task_id": "generate_summary",
      "description": "Create summary report of the sync operation",
      "candidate_tools": ["report_builder"],
      "dependencies": [
        {
          "task_id": "sync_to_marketing"
        }
      ],
      "expected_output": "Summary with statistics and any errors",
      "output_variable_name": "sync_summary",
      "output_template": "Sync completed at: [TIMESTAMP]\nContacts processed: [TOTAL]\nSuccessful: [SUCCESS]\nFailed: [FAILED]\nErrors: [ERROR_LIST]"
    }
  ],
  "variables_required_to_final_answer": ["sync_summary", "sync_results"],
  "version": "1.0"
}

Key Concepts Demonstrated

  • API Integration: Working with external systems
  • Data Validation: Quality checks before processing
  • Error Handling: Tracking success/failure states
  • Structured Output: Template-based reporting

Best Practices from Examples

  1. Clear Task Descriptions: Make each task's purpose obvious
  2. Logical Dependencies: Ensure proper execution order
  3. Variable Naming: Use descriptive names for output variables
  4. Known Arguments: Pre-configure values when possible
  5. Output Templates: Structure outputs for consistency
  6. Error Consideration: Plan for failure scenarios
  7. Final Variables: Always specify what's needed for the final answer

Tips for Building Your Own Automations

  1. Start Simple: Begin with linear workflows before adding complexity
  2. Test Incrementally: Validate each task before adding dependencies
  3. Document Assumptions: Use task descriptions to clarify intent
  4. Plan Variables: Map out data flow before writing configuration
  5. Consider Failures: Design with error handling in mind
  6. Optimize Tool Usage: Group related operations when possible
  7. Review Output: Ensure final variables contain complete information

Next Steps