Workflow automation

From XSpoonAi/spoon-awesome-skill · View interactive version

Workflow automation is an AI agent skill from the GitHub repository XSpoonAi/spoon-awesome-skill. Automate complex workflows and repetitive tasks using AI agents and tool integration. Use when user wants to create automated pipelines, integrate multiple services, or build task-specific agents.

How to use this skill

Skill file

AI Workflow Automation

Create intelligent, automated workflows that combine AI reasoning with external tool execution. This skill enables the construction of robust pipelines for data processing, content generation, and system integration, moving beyond simple scripts to adaptive, state-aware agents.

When to Use

Decision Flow

Determine the complexity and requirements of the automation.

User Request for Automation
        │
  Analyze Complexity
        │
   ┌────┴─────────────────┐
 Simple                 Complex
 (Linear Sequence)      (Branching/Looping/State)
    │                      │
  Script                 Agent / Graph
  Based                  Based
    │                      │
    │                  Need Human Approval?
    │                  ┌───┴───┐
    │                 Yes     No
    │                  │       │
    │             Human-in-  Fully
    │             the-loop   Autonomous
    │                  │       │
    └──────┬───────────┴───────┘
           │
     Select Tools & APIs
           │
     Define State Schema
           │
     Implement Logic
           │
     Test & Deploy

Core Concepts

  1. Triggers: Events that initiate the workflow (e.g., Schedule/Cron, Webhook, Manual Input, File Upload).
  2. Steps (Nodes): Discrete units of work.
  1. State: The shared context passed between steps (e.g., messages, current_data, errors).
  2. Routing (Edges): Logic to determine the next step based on current state (e.g., "if error, go to retry; else go to finish").
  3. Human-in-the-loop: Pausing execution for human review before proceeding with critical actions.

Implementation Guide

Step 1: Define the Workflow

Clearly outline the inputs, processing steps, decision points, and desired outputs.

_Example: Daily Tech News Digest_

1. Fetch latest articles.

2. Filter for relevance (e.g., "AI", "LLM").

3. Summarize each article into 3 bullet points.

4. Generate an HTML email template.

Step 2: Select Tools & Manage Secrets

Identify necessary integrations and ensure API keys are managed securely (e.g., .env file).

Security Note: Never hardcode API keys. Use os.getenv("API_KEY").

Step 3: Build the Agent (SpoonReactSkill)

For simpler, tool-using agents, use SpoonReactSkill.

import os
from spoon_ai.agents import SpoonReactSkill
from spoon_ai.tools import Tool
from spoon_ai.llm import ChatBot

class NewsDigestAgent(SpoonReactSkill):
    def __init__(self):
        super().__init__(
            name="news_digest_bot",
            description="Fetches and summarizes tech news.",
            llm=ChatBot(model="gpt-4o"),
            tools=[self.fetch_news, self.send_email]
        )

    @Tool
    def fetch_news(self, topic: str) -> str:
        """Fetches latest news about a topic. Returns JSON string of articles."""
        # Mock implementation
        return f"Found 5 articles about {topic}..."

    @Tool
    def send_email(self, recipient: str, subject: str, content: str) -> str:
        """Sends the summarized content via email."""
        print(f"Sending email to {recipient}: {subject}")
        return "Email sent successfully."

# Usage
async def run_agent():
    agent = NewsDigestAgent()
    await agent.initialize()
    result = await agent.run("Send me a digest of today's AI news to user@example.com")
    print(result)

Step 4: Orchestration (StateGraph)

For complex workflows with strict control flow, loops, or state management, use StateGraph.

from typing import TypedDict, Annotated
from langgraph.graph import StateGraph, END

class AgentState(TypedDict):
    topic: str
    articles: list
    summary: str

def fetch_node(state: AgentState):
    # Fetch logic
    return {"articles": ["Article 1", "Article 2"]}

def summarize_node(state: AgentState):
    # LLM summarization logic
    summary = f"Summary of {len(state['articles'])} articles..."
    return {"summary": summary}

def notify_node(state: AgentState):
    # Send notification
    print(f"Sending: {state['summary']}")
    return {}

# Define Graph
workflow = StateGraph(AgentState)
workflow.add_node("fetch", fetch_node)
workflow.add_node("summarize", summarize_node)
workflow.add_node("notify", notify_node)

workflow.set_entry_point("fetch")
workflow.add_edge("fetch", "summarize")
workflow.add_edge("summarize", "notify")
workflow.add_edge("notify", END)

app = workflow.compile()

Example Workflows

1. Automated Code Reviewer

Goal: Automatically review new Pull Requests and post comments.

  1. Trigger: GitHub Webhook (PR Created).
  2. Step 1 (Fetch): Get PR diff using GitHub API.
  3. Step 2 (Analyze): Send diff to LLM with prompt "Identify bugs and security risks".
  4. Step 3 (Filter): Ignore minor style issues if configured.
  5. Step 4 (Post): Post review comments to GitHub PR.

2. Customer Support Triage

Goal: Categorize and draft responses for support tickets.

  1. Trigger: New ticket in Zendesk/Jira.
  2. Step 1 (Read): Extract ticket subject and body.
  3. Step 2 (Classify): LLM classifies intent (Billing, Technical, Feature Request).
  4. Step 3 (RAG): Retrieve relevant documentation based on classification.
  5. Step 4 (Draft): Generate response using retrieved docs.
  6. Step 5 (Human Review): Save as "Draft" status for human agent approval.

3. Social Media Content Calendar

Goal: Generate and schedule posts from a blog RSS feed.

  1. Trigger: New item in RSS feed.
  2. Step 1 (Extract): Get title, content, and URL.
  3. Step 2 (Generate): Create variations for Twitter (short), LinkedIn (professional), and Facebook.
  4. Step 3 (Image): Generate a thumbnail using DALL-E / Midjourney API.
  5. Step 4 (Schedule): Post to Buffer/Hootsuite API.

Tools & Integrations

| Category | Common Tools | Use Case |

| :---------------- | :------------------------------------------ | :----------------------------------- |

| Communication | Slack, Discord, Telegram, Email (SMTP/IMAP) | Notifications, Chatbots, Alerts |

| Development | GitHub, GitLab, Jira, Linear | Code review, Issue tracking |

| Data/Docs | Notion, Google Sheets, Airtable, Vector DBs | Knowledge base, CRM, structured data |

| Social | Twitter (X), LinkedIn, Reddit | Content publishing, monitoring |

| Search | Tavily, Google Search, Bing | Real-time information retrieval |

Debugging & Monitoring

Security & Privacy

Best Practices

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.