{
  "id": "3v8t7FV5f5vkU9LM",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Data analytics Workflow 4 bakery.",
  "tags": [],
  "nodes": [
    {
      "id": "e559ce26-07d1-4bca-aa53-082ff8480e63",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -384,
        -192
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "517129d9-18fc-4bf3-8193-8d8ed8fb8b1f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -112,
        -192
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a professional Data Analysis Assistant specialized in Excel datasets. \nYou never assume what the user wants \u2014 you only respond based on their exact question. \n\nBehavior & Tone:\n- Clear, concise, and professional.\n- Always answer in plain English, avoiding unnecessary jargon.\n- Use short, structured insights (bullets, small tables, or compact summaries).\n- Keep responses brief but meaningful \u2014 no long reports unless explicitly requested.\n- Provide actionable insights when appropriate, but do not invent analysis that was not asked.\n\nInstructions:\n1. Only analyze the Excel data when the user asks a specific question.\n2. Never output full raw data unless explicitly requested.\n3. Present results in a compact format (e.g., weekly breakdown, totals, highlights) if the question relates to time or quantities.\n4. If the data is insufficient, state the limitation clearly.\n5. Keep a balanced tone: informative, decision-oriented, and easy to understand.\n6. Never assume tasks \u2014 wait for user instructions before analyzing. \n7. If a recommendation is reasonable (like stocking, trends, or anomalies), keep it short and relevant to the user\u2019s query.\n"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ed8f4fe1-272f-4657-ac41-36ffb7456bb1",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -16,
        32
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "d1a293d6-7e5b-4543-9107-9caf45b4051a",
      "name": "Retrieve bakery data",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        320,
        -80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 764145761,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCCQzjoDZak-mQD1iyGd5aHKGFeh15fsBPUIoTgAYGw/edit#gid=764145761",
          "cachedResultName": "Full Month"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1dCCQzjoDZak-mQD1iyGd5aHKGFeh15fsBPUIoTgAYGw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1dCCQzjoDZak-mQD1iyGd5aHKGFeh15fsBPUIoTgAYGw/edit?usp=drivesdk",
          "cachedResultName": "Bakery data 1 month"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1106cbea-591d-4dd4-88dd-03ad52052e38",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -400,
        32
      ],
      "parameters": {
        "model": "gpt-5-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc450b50-9326-40a1-a25a-c044c459a1ff",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -512
      ],
      "parameters": {
        "width": 256,
        "height": 496,
        "content": "## Workflow: **Data Analytics for Bakery**\n\n### Node 1: **When chat message received**\n\n*Purpose:*\nThis node acts as the **entry point** of the workflow. It triggers the process whenever a user sends a **chat message**.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "982b0dd2-ac23-47d6-a91b-5df8d2d42527",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -512
      ],
      "parameters": {
        "color": 3,
        "width": 336,
        "height": 496,
        "content": "### Node 2: **AI Agent**\n\n*Purpose:*\nThis is the **central AI reasoning engine**. It processes the user\u2019s request, interprets the context, and decides how to handle it.\n\n*Key roles:*\n\n* Ensures **professional and concise** responses\n* Analyzes bakery Excel data only when asked\n* Provides insights in **plain English** with short, actionable summaries\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4fa77358-11a8-4c21-bdb2-c1f606773d17",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        144
      ],
      "parameters": {
        "color": 2,
        "width": 320,
        "height": 272,
        "content": "### Node 3: **Simple Memory**\n\n*Purpose:*\nThis node stores **short-term conversational memory**.\n\n*Key roles:*\n\n* Keeps track of the **previous chat context**\n* Allows the AI to maintain continuity during ongoing discussions\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3e234b21-725b-4aaa-a767-a2a05e744a55",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -384
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 432,
        "content": "### Node 4: **Retrieve bakery data**\n\n*Purpose:*\nThis node connects to the **Google Sheets bakery dataset**.\n\n*Key roles:*\n\n* Retrieves sales and stock data from the linked **spreadsheet**\n* Provides structured data for the AI Agent to analyze\n* Dataset: [Bakery Data Sheet](https://docs.google.com/spreadsheets/d/1dCCQzjoDZak-mQD1iyGd5aHKGFeh15fsBPUIoTgAYGw/edit?usp=drivesdk)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4b5eb0ce-e311-4bed-821b-fcf7e5cf74ba",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        176
      ],
      "parameters": {
        "color": 6,
        "width": 352,
        "height": 336,
        "content": "### Node 5: **Azure OpenAI Chat Model**\n\n*Purpose:*\nThis node provides the **language model backend** for the AI Agent.\n\n*Key roles:*\n\n* Uses **GPT-based reasoning** for natural conversation\n* Handles query understanding and response generation\n* Ensures responses follow the defined **tone and style**\n"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fe8411cd-b13e-40b3-beca-c579c00be0fc",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve bakery data": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}