All Toolsโ€บClaude Task Dispatcher
๐Ÿ”ง Claude AI AutomationApril 24, 2026โœ… Tests passing

Claude Task Dispatcher

A CLI tool that integrates with Claude AI's dispatch features to schedule and manage tasks programmatically. This tool enables developers to define workflows and automatically execute them based on predefined triggers or schedules, enhancing productivity in AI-related projects.

What It Does

  • Load workflows from JSON or YAML files.
  • Execute tasks defined in workflows.
  • Schedule workflows using cron-like expressions.

Installation

Install the required dependencies using pip:

pip install requests schedule pyyaml

Usage

Run the tool using the command line:

python claude_task_dispatcher.py --workflow <path_to_workflow_file> [--execute | --schedule <cron_expression>]

Options

  • --workflow: Path to the workflow file (JSON or YAML).
  • --execute: Immediately execute the workflow.
  • --schedule: Schedule the workflow using a cron-like expression (e.g., */15 * * * *).

Example

To execute a workflow immediately:

python claude_task_dispatcher.py --workflow example_workflow.json --execute

To schedule a workflow:

python claude_task_dispatcher.py --workflow example_workflow.yaml --schedule "*/15 * * * *"

Source Code

import os
import sys
import json
import yaml
import logging
import requests
import schedule
import time
import argparse
from datetime import datetime

def load_workflow(file_path):
    """Load workflow from a JSON or YAML file."""
    try:
        with open(file_path, 'r') as f:
            if file_path.endswith('.json'):
                return json.load(f)
            elif file_path.endswith('.yml') or file_path.endswith('.yaml'):
                return yaml.safe_load(f)
            else:
                raise ValueError("Unsupported file format. Use JSON or YAML.")
    except Exception as e:
        logging.error(f"Failed to load workflow file: {e}")
        sys.exit(1)

def execute_task(task):
    """Execute a single task."""
    try:
        if task['type'] == 'http_request':
            response = requests.request(
                method=task['method'],
                url=task['url'],
                headers=task.get('headers', {}),
                json=task.get('body', {})
            )
            logging.info(f"Task executed: {task['name']} - Status: {response.status_code}")
        else:
            logging.warning(f"Unsupported task type: {task['type']}")
    except Exception as e:
        logging.error(f"Error executing task {task['name']}: {e}")

def execute_workflow(workflow):
    """Execute all tasks in the workflow."""
    logging.info(f"Starting workflow: {workflow['name']}")
    for task in workflow['tasks']:
        execute_task(task)
    logging.info(f"Workflow completed: {workflow['name']}")

def schedule_workflow(workflow, cron_expression):
    """Schedule a workflow based on a cron-like expression."""
    def job():
        execute_workflow(workflow)

    try:
        schedule.every().minute.at(cron_expression).do(job)
        logging.info(f"Workflow scheduled: {workflow['name']} with cron: {cron_expression}")

        while True:
            schedule.run_pending()
            time.sleep(1)
    except Exception as e:
        logging.error(f"Error scheduling workflow: {e}")
        sys.exit(1)

def main():
    """Main CLI entry point."""
    parser = argparse.ArgumentParser(description="Claude Task Dispatcher")
    parser.add_argument('--workflow', required=True, type=str, help='Path to the workflow file (JSON or YAML).')
    parser.add_argument('--schedule', type=str, default=None, help='Cron-like schedule expression (e.g., "/15 * * * *").')
    parser.add_argument('--execute', action='store_true', help='Immediately execute the workflow.')

    args = parser.parse_args()

    logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
    workflow_data = load_workflow(args.workflow)

    if args.execute:
        execute_workflow(workflow_data)
    elif args.schedule:
        schedule_workflow(workflow_data, args.schedule)
    else:
        logging.error("Either --execute or --schedule must be specified.")
        sys.exit(1)

if __name__ == '__main__':
    main()

Community

Downloads

ยทยทยท

Rate this tool

No ratings yet โ€” be the first!

Details

Tool Name
claude_task_dispatcher
Category
Claude AI Automation
Generated
April 24, 2026
Tests
Passing โœ…
Fix Loops
2

Quick Install

Clone just this tool:

git clone --depth 1 --filter=blob:none --sparse \
  https://github.com/ptulin/autoaiforge.git
cd autoaiforge
git sparse-checkout set generated_tools/2026-04-24/claude_task_dispatcher
cd generated_tools/2026-04-24/claude_task_dispatcher
pip install -r requirements.txt 2>/dev/null || true
python claude_task_dispatcher.py
Claude Task Dispatcher โ€” AI Tools by AutoAIForge