Swirls

SWIRLS_

  • How it works
  • Pricing

56 matches

OverviewDeliver client operations10Win and grow accounts8Resolve customer issues6Create and distribute content9Run people and operations5Review money and agreements3Monitor systems and data9Compose dependable work6

56 matches

OverviewDeliver client operations10Win and grow accounts8Resolve customer issues6Create and distribute content9Run people and operations5Review money and agreements3Monitor systems and data9Compose dependable work6
← PatternsWebhookView on GitHub

Parallel Branches

Fan-out: root splits into multiple independent nodes that run concurrently.

ai

Source

/**
 * Demonstrates parallel branches in a workflow.
 * Root fans out to multiple independent nodes; the branches join downstream.
 */

webhook article_submitted {
  label: "Article Submitted"
  schema: @json {
    {
      "type": "object",
      "required": ["title", "body", "author"],
      "properties": {
        "title": { "type": "string" },
        "body": { "type": "string" },
        "author": { "type": "string" }
      }
    }
  }
}

workflow process_article {
  label: "Process Article"

  root {
    type: code
    label: "Extract article"
    code: @ts { return context.nodes.root.input }
    outputSchema: @json {
      {
        "type": "object",
        "properties": {
          "title": { "type": "string" },
          "body": { "type": "string" },
          "author": { "type": "string" }
        }
      }
    }
  }

  node extract_keywords {
    type: ai
    label: "Extract keywords"
    kind: object
    model: "google/gemini-2.5-flash"
    prompt: @ts {
      return "Extract 5-10 keywords from this article.\n\nTitle: " + context.nodes.root.output.title + "\n\n" + context.nodes.root.output.body
    }
    schema: @json {
      {
        "type": "object",
        "required": ["keywords"],
        "properties": {
          "keywords": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }

  node generate_summary {
    type: ai
    label: "Generate summary"
    kind: text
    model: "google/gemini-2.5-flash"
    prompt: @ts {
      return "Write a 2-sentence summary of this article.\n\nTitle: " + context.nodes.root.output.title + "\n\n" + context.nodes.root.output.body
    }
  }

  node estimate_read_time {
    type: code
    label: "Estimate read time"
    code: @ts {
      const words = context.nodes.root.output.body.split(" ").length
      return { read_time_minutes: Math.ceil(words / 200) }
    }
  }

  node combine {
    type: code
    label: "Combine results"
    code: @ts {
      return {
        title: context.nodes.root.output.title,
        author: context.nodes.root.output.author,
        summary: context.nodes.generate_summary.output,
        keywords: context.nodes.extract_keywords.output.keywords,
        read_time: context.nodes.estimate_read_time.output.read_time_minutes
      }
    }
  }

  flow {
    root -> extract_keywords
    root -> generate_summary
    root -> estimate_read_time
    extract_keywords -> combine
    generate_summary -> combine
    estimate_read_time -> combine
  }
}

trigger on_article {
  webhook:article_submitted -> process_article
  enabled: true
}

Flow

Trigger to workflow

article_submittedwebhook
process_article
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

Workflow nodes

CODE
Code Node
Extract article
AI
AI Node
Extract keywords
AI
AI Node
Generate summary
CODE
Code Node
Estimate read time
CODE
Code Node
Combine results
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.