๐ง AI-Powered Task AutomationApril 15, 2026โ
Tests passing
AI Task Flow Creator
This tool allows developers to define, manage, and execute automated workflows powered by AI models like Claude Code. It simplifies chaining multiple tasks, handling dependencies, and leveraging AI models for decision-making and data transformation.
What It Does
- Define workflows in YAML or JSON format.
- Execute tasks sequentially based on dependencies.
- Use AI models for decision-making or data transformation.
Installation
Install the required Python packages:
pip install openai pyyaml networkxUsage
Run the tool from the command line:
python ai_task_flow.py --workflow <path_to_workflow_file> --api-key <your_openai_api_key>Workflow File Format
The workflow file can be in YAML or JSON format. Example:
#### YAML:
tasks:
- name: task1
dependencies: []
ai_step:
prompt: "What is the weather today?"
- name: task2
dependencies: [task1]
ai_step:
prompt: "What is the temperature today?"#### JSON:
{
"tasks": [
{
"name": "task1",
"dependencies": [],
"ai_step": {
"prompt": "What is the weather today?"
}
},
{
"name": "task2",
"dependencies": ["task1"],
"ai_step": {
"prompt": "What is the temperature today?"
}
}
]
}Source Code
import argparse
import json
import yaml
import logging
import networkx as nx
from openai import ChatCompletion
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def load_workflow(file_path):
"""Load workflow from a YAML or JSON file."""
try:
with open(file_path, 'r') as f:
content = f.read()
if file_path.endswith('.yaml') or file_path.endswith('.yml'):
return yaml.safe_load(content)
elif file_path.endswith('.json'):
return json.loads(content)
else:
raise ValueError("Unsupported file format. Use YAML or JSON.")
except Exception as e:
logging.error(f"Error loading workflow file: {e}")
raise
def execute_task(task, ai_model):
"""Execute a single task using AI model if specified."""
try:
if 'ai_step' in task:
prompt = task['ai_step']['prompt']
logging.info(f"Executing AI step for task: {task['name']}")
response = ai_model.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": prompt}]
)
return response.choices[0].message['content']
else:
logging.info(f"Executing non-AI task: {task['name']}")
return task.get('output', None)
except Exception as e:
logging.error(f"Error executing task {task['name']}: {e}")
raise
def execute_workflow(workflow, ai_api_key):
"""Execute the workflow defined in the input file."""
try:
ai_model = ChatCompletion(api_key=ai_api_key)
graph = nx.DiGraph()
# Build the graph
for task in workflow['tasks']:
graph.add_node(task['name'], task=task)
for dependency in task.get('dependencies', []):
graph.add_edge(dependency, task['name'])
# Execute tasks in topological order
for task_name in nx.topological_sort(graph):
task = graph.nodes[task_name]['task']
output = execute_task(task, ai_model)
logging.info(f"Task '{task_name}' completed with output: {output}")
except Exception as e:
logging.error(f"Error executing workflow: {e}")
raise
def main():
parser = argparse.ArgumentParser(description="AI Task Flow Creator")
parser.add_argument('--workflow', required=True, help="Path to the workflow YAML or JSON file")
parser.add_argument('--api-key', required=True, help="OpenAI API key")
args = parser.parse_args()
try:
workflow = load_workflow(args.workflow)
execute_workflow(workflow, args.api_key)
except Exception as e:
logging.error(f"Error: {e}")
if __name__ == "__main__":
main()
Community
Downloads
ยทยทยท
Rate this tool
No ratings yet โ be the first!
Details
- Tool Name
- ai_task_flow
- Category
- AI-Powered Task Automation
- Generated
- April 15, 2026
- Tests
- Passing โ
- Fix Loops
- 3
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-15/ai_task_flow cd generated_tools/2026-04-15/ai_task_flow pip install -r requirements.txt 2>/dev/null || true python ai_task_flow.py