{
  "name": "Classify and Route",
  "description": "Sort an incoming message into billing, technical, sales or other and route it to the right response — on-device.",
  "tags": [
    "classify",
    "routing",
    "on-device ai",
    "triage",
    "support",
    "categorize"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "🔀 Classify a message, then route it.\n\nPaste a support message, press Run, and a local model tags it as billing / technical / sales / other. A Switch then sends it down the matching branch. Everything runs in your browser. Pick a model the first time.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 360,
      "height": 210,
      "measured": {
        "width": 360,
        "height": 210
      }
    },
    {
      "id": "trigger-run",
      "position": {
        "x": 100,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:whenStarted"
        },
        "label": "Run now",
        "inputs": {},
        "parameters": {
          "notes": "Starts the workflow when you press Run."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "trigger",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "sample-text",
      "position": {
        "x": 420,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:editFields"
        },
        "label": "Message to sort",
        "inputs": {
          "fields": {
            "text": {
              "type": "string",
              "value": "Hi, I was charged twice for my subscription this month and need a refund."
            }
          }
        },
        "parameters": {
          "notes": "Paste the message you want to classify. Replace the sample with your own."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false
    },
    {
      "id": "classify",
      "position": {
        "x": 740,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:agent:text-classifier"
        },
        "label": "Classify the message",
        "inputs": {
          "text": "{{ $input.text }}",
          "categories": "billing, technical, sales, other"
        },
        "parameters": {
          "notes": "Tags the message with one of the four categories."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "agent",
      "measured": {
        "width": 144,
        "height": 50
      },
      "selected": false
    },
    {
      "id": "local-model",
      "position": {
        "x": 740,
        "y": 540
      },
      "data": {
        "instance": {
          "id": "af-base-node:dependency:webLLM"
        },
        "label": "Local AI model",
        "inputs": {
          "model": "",
          "options": {
            "temperature": 0.2
          }
        },
        "parameters": {
          "notes": "Runs the classification locally in your browser. Pick a model the first time — it downloads once, then works offline."
        },
        "runned": false,
        "isRunning": false,
        "failed": false,
        "wasRunned": false,
        "skipped": false
      },
      "type": "dependency",
      "measured": {
        "width": 30,
        "height": 30
      },
      "selected": false
    },
    {
      "id": "route",
      "position": {
        "x": 1060,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:switch"
        },
        "label": "Route by category",
        "inputs": {
          "mode": "rules",
          "matchMode": "firstMatch",
          "includeFallback": true,
          "fallbackName": "Other",
          "rules": [
            {
              "outputName": "Billing",
              "conditions": [
                {
                  "leftSide": "{{ $input.category }}",
                  "rightSide": "billing",
                  "operator": {
                    "operationType": "string",
                    "operatorValue": "=="
                  }
                }
              ]
            },
            {
              "outputName": "Technical",
              "conditions": [
                {
                  "leftSide": "{{ $input.category }}",
                  "rightSide": "technical",
                  "operator": {
                    "operationType": "string",
                    "operatorValue": "=="
                  }
                }
              ]
            },
            {
              "outputName": "Sales",
              "conditions": [
                {
                  "leftSide": "{{ $input.category }}",
                  "rightSide": "sales",
                  "operator": {
                    "operationType": "string",
                    "operatorValue": "=="
                  }
                }
              ]
            }
          ]
        },
        "parameters": {
          "notes": "Sends the message down the branch that matches its category. Anything that isn't billing, technical or sales falls through to Other."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": true
    },
    {
      "id": "show-billing",
      "position": {
        "x": 1400,
        "y": 120
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Billing branch",
        "inputs": {
          "title": "Billing",
          "content": "💳 **Billing request** — route to the billing team and pull up the customer's invoices."
        },
        "parameters": {
          "notes": "What happens when the message is about billing."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "show-technical",
      "position": {
        "x": 1400,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Technical branch",
        "inputs": {
          "title": "Technical",
          "content": "🛠️ **Technical issue** — route to support engineering and ask for steps to reproduce."
        },
        "parameters": {
          "notes": "What happens when the message is a technical issue."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "show-sales",
      "position": {
        "x": 1400,
        "y": 480
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Sales branch",
        "inputs": {
          "title": "Sales",
          "content": "📈 **Sales enquiry** — route to the sales team and share pricing details."
        },
        "parameters": {
          "notes": "What happens when the message is a sales enquiry."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "show-other",
      "position": {
        "x": 1400,
        "y": 660
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Other branch",
        "inputs": {
          "title": "Other",
          "content": "📥 **Uncategorised** — send to the general inbox for a human to triage."
        },
        "parameters": {
          "notes": "The Switch fallback — anything that didn't match a category."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "sticky-model",
      "position": {
        "x": 740,
        "y": 700
      },
      "data": {
        "color": "#c9f0d1",
        "content": "Setup needed: pick a local model the first time you run this. It downloads once, then runs fully offline. Edit each branch to trigger your own follow-up actions.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 320,
      "height": 130,
      "measured": {
        "width": 320,
        "height": 130
      }
    }
  ],
  "edges": [
    {
      "id": "e-run-sample",
      "type": "flowEdge",
      "source": "trigger-run",
      "target": "sample-text",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-sample-classify",
      "type": "flowEdge",
      "source": "sample-text",
      "target": "classify",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-classify-model",
      "type": "flowEdge",
      "source": "classify",
      "target": "local-model",
      "sourceHandle": "dependency-0",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-classify-route",
      "type": "flowEdge",
      "source": "classify",
      "target": "route",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-route-billing",
      "type": "flowEdge",
      "source": "route",
      "target": "show-billing",
      "sourceHandle": "output-Billing",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-route-technical",
      "type": "flowEdge",
      "source": "route",
      "target": "show-technical",
      "sourceHandle": "output-Technical",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-route-sales",
      "type": "flowEdge",
      "source": "route",
      "target": "show-sales",
      "sourceHandle": "output-Sales",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-route-other",
      "type": "flowEdge",
      "source": "route",
      "target": "show-other",
      "sourceHandle": "output-__fallback__",
      "markerEnd": {
        "type": "arrowclosed"
      }
    }
  ],
  "requiredInputs": [
    {
      "nodeId": "local-model",
      "field": "model"
    }
  ]
}