Pizza Workflow

    Shared 10/19/2025

    112 views

    Visual Workflow

    JSON Code

    {
      "id": "DvB8KqllFMSL8dh3",
      "meta": {
        "instanceId": "9a93705676cef812bba4609ac2e211f44c4c6a4ffff0d6ade780528db2a298ee",
        "templateCredsSetupCompleted": true
      },
      "name": "PizzaAgent",
      "tags": [],
      "nodes": [
        {
          "id": "ce5377f5-826f-40a2-bf51-188ce2329ef6",
          "name": "When chat message received",
          "type": "@n8n/n8n-nodes-langchain.chatTrigger",
          "position": [
            0,
            0
          ],
          "webhookId": "d8d3eb07-a677-48a3-a6ea-2c2338df2be5",
          "parameters": {
            "options": {
              "responseMode": "responseNodes"
            }
          },
          "typeVersion": 1.3
        },
        {
          "id": "63106e20-c640-48c1-9785-650e15e69b86",
          "name": "AI Agent",
          "type": "@n8n/n8n-nodes-langchain.agent",
          "position": [
            208,
            0
          ],
          "parameters": {
            "options": {
              "systemMessage": "You are a helpful assistant supporting customers in ordering pizza.\n\nWhen receiving a request for ordering pizza use the following steps to determine which pizzas the customer wants to have and in which qwuantity.\n\n1. check the available pizzas via the 'PizzaTool'. You will receive the names of the available pizza types and a list of their ingredients.\n\n2. map the types of pizzas the customer wants to order against the available pizza types. Use either the name of the pizza or specifics of the ingredients. E.g if the customer asks for 'a pizza' you must find exactly 1 type of pizza and set the quantity to exactly 1.\n\n3. if you are not certain about the pizzas the customer wants to order, ask for help: use the 'help_needed' flag (set value to 'true') and include your question for additional information to help answer the pizza request of the customer.\n\n4. if you are absolutely certain about the types of pizzas the customers want to order (you can map each requested pizza to exactly one available pizza), set the 'help_needed' flag to false and return the names of the pizzas as well as the quantities.\n\nWhen in doubt: ask the additional information before returning the pizza order."
            },
            "hasOutputParser": true
          },
          "typeVersion": 2.2
        },
        {
          "id": "67885492-dae3-4233-a96c-49a86bd98355",
          "name": "Ollama Chat Model",
          "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
          "position": [
            112,
            208
          ],
          "parameters": {
            "model": "hf.co/Qwen/Qwen3-8B-GGUF:Q4_K_M",
            "options": {}
          },
          "credentials": {
            "ollamaApi": {
              "id": "ciAfrmrQNNEwCDQi",
              "name": "Ollama account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "750aac81-f086-432e-a341-41e552a7bb8a",
          "name": "Simple Memory",
          "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
          "position": [
            224,
            208
          ],
          "parameters": {},
          "typeVersion": 1.3
        },
        {
          "id": "1584c4ed-dd9c-4fd9-b242-dc0197c79edc",
          "name": "Structured Output Parser",
          "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
          "position": [
            448,
            208
          ],
          "parameters": {
            "schemaType": "manual",
            "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n        \"help_needed\": {\n          \"type\": \"boolean\"\n        },\n        \"question\":{\n          \"type\": \"string\"\n        },\n\t\t\"pizzas\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"object\",\n                \"properties\": {\n                  \"name\":{\n                    \"type\": \"string\"},\n                  \"quantity\":{\n                    \"type\": \"int\"}\n                }\n\t\t\t}\n\t\t}\n\t}\n}"
          },
          "typeVersion": 1.3
        },
        {
          "id": "15c23d5a-ed81-433a-8340-5b956917b3ca",
          "name": "PizzaTool",
          "type": "@n8n/n8n-nodes-langchain.toolCode",
          "position": [
            336,
            208
          ],
          "parameters": {
            "language": "python",
            "pythonCode": "import json\n\nreturn json.dumps([{'name': 'Margerita', 'ingredients': 'Mozzarella, Tomato Sauce, Basil'}, {'name': 'Salami', 'ingredients': 'Mozzarella, Tomato Sauce, Salami'}])",
            "description": "Call this tool to get all available pizzas at our store including their ingredients."
          },
          "typeVersion": 1.3
        },
        {
          "id": "10a536a3-31b6-44dd-a912-58b9956b23d3",
          "name": "If",
          "type": "n8n-nodes-base.if",
          "position": [
            560,
            0
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "60b40f9b-a861-4ff9-9eaf-e924ed5b0a7d",
                  "operator": {
                    "type": "boolean",
                    "operation": "exists",
                    "singleValue": true
                  },
                  "leftValue": "={{ $json.output.help_needed }}",
                  "rightValue": ""
                },
                {
                  "id": "689135b8-f5b9-42bc-9e2e-b48d2275f7eb",
                  "operator": {
                    "type": "boolean",
                    "operation": "true",
                    "singleValue": true
                  },
                  "leftValue": "={{ $json.output.help_needed }}",
                  "rightValue": ""
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "81600840-f7f3-4249-9579-f93483f0b0eb",
          "name": "Respond to Chat",
          "type": "@n8n/n8n-nodes-langchain.chat",
          "position": [
            784,
            -208
          ],
          "parameters": {
            "message": "={{ $json.output.question }}",
            "options": {}
          },
          "typeVersion": 1
        },
        {
          "id": "5d4c5dc4-2de1-4789-b1dd-1b82ea1564aa",
          "name": "Respond to Chat1",
          "type": "@n8n/n8n-nodes-langchain.chat",
          "position": [
            784,
            112
          ],
          "parameters": {
            "message": "=Summary of your order: {{ JSON.stringify($json.output.pizzas) }}",
            "options": {},
            "waitUserReply": false
          },
          "typeVersion": 1
        }
      ],
      "active": false,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "03fe60ff-783e-4d98-b2c2-7318942dc1f6",
      "connections": {
        "If": {
          "main": [
            [
              {
                "node": "Respond to Chat",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Respond to Chat1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "AI Agent": {
          "main": [
            [
              {
                "node": "If",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "PizzaTool": {
          "ai_tool": [
            [
              {
                "node": "AI Agent",
                "type": "ai_tool",
                "index": 0
              }
            ]
          ]
        },
        "Simple Memory": {
          "ai_memory": [
            [
              {
                "node": "AI Agent",
                "type": "ai_memory",
                "index": 0
              }
            ]
          ]
        },
        "Respond to Chat": {
          "main": [
            [
              {
                "node": "AI Agent",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Ollama Chat Model": {
          "ai_languageModel": [
            [
              {
                "node": "AI Agent",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Structured Output Parser": {
          "ai_outputParser": [
            [
              {
                "node": "AI Agent",
                "type": "ai_outputParser",
                "index": 0
              }
            ]
          ]
        },
        "When chat message received": {
          "main": [
            [
              {
                "node": "AI Agent",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }