{
  "name": "BCA - Website Assistant",
  "nodes": [
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('AgentBrains Trigger').item.json.data.conversation_id }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -160,
        528
      ],
      "id": "dcd86827-6b01-455e-924e-8017aa9c0243",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "95c5fa10-4326-401c-aebd-cd810dd87f73",
              "name": "message",
              "value": "={{ $json.output }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        544,
        208
      ],
      "id": "ee7bf4f5-1b56-47a9-bb90-21058ff0aaf3",
      "name": "response"
    },
    {
      "parameters": {
        "resource": "rag",
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "toolDescription": "This tool performs a semantic search query against the connected vector-based knowledge base and returns the most relevant text fragments. Use this tool whenever factual information, documentation excerpts, product details, or any knowledge stored in the indexed documents is required.\n\nInput:\n- query (string, required): A natural-language question or keyword phrase describing what information should be retrieved.\n\nOutput:\nReturns a list of matched documents containing:\n- extracted text segments,\n- relevance scores,\n- metadata (source URL, document name, tags, line numbers).\n\nUsage Guidelines:\n- Use this tool when the user asks for information that may exist in manuals, guides, product documentation, or any indexed knowledge.\n- Use it when accurate factual data is needed instead of assumptions or generated content.\n- Provide clear and specific queries for best results.\n\nLimitations:\n- The tool does not generate new information; it only retrieves existing content from the knowledge base.\n- Returned text may be partial; additional queries may be required for full context.\n\nError Handling:\nIf the tool returns no results or low-confidence matches, reformulate the query with more specific keywords or request clarification from the user.\n",
        "options": {}
      },
      "type": "n8n-nodes-agent-brains.agentBrainsTool",
      "typeVersion": 1,
      "position": [
        80,
        592
      ],
      "id": "a54e4383-30cb-41ca-a1bb-ebae5edc016d",
      "name": "search_knowledge_base",
      "credentials": {
        "agentBrainsIntegrationApi": {
          "id": "OXX19UWa1c40zWVn",
          "name": "Demo Key"
        }
      }
    },
    {
      "parameters": {
        "resource": "rag",
        "operation": "image",
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "toolDescription": "This tool performs a semantic search in a visual database and returns the single most relevant image that matches the given text description. Use this tool when a user’s request requires a visual example, can be clarified with an image, or would benefit from visual context.\n\nInput:\n- query (string, required): A natural-language description of the image you want to find. \n\nOutput:\nReturns:\n- the URL of the best-matching image, \n- or null if no relevant image is found.\nIf extended response mode is enabled, additional metadata may be included (image type, tags, source, descriptive text).\n\nUsage Guidelines:\n- Use this tool when the user asks for a visual reference, screenshot, product interface, or any image that may exist in the visual knowledge base.\n- Use it when visual clarification improves the answer or when the user explicitly requests an image.\n- Provide clear and specific descriptions for best results.\n\nLimitations:\n- The tool does not generate new images; it only retrieves existing ones from the visual database.\n- If the query is vague, results may be less accurate.\n- Only one image is returned — the highest-scoring match.\n\nError Handling:\nIf no relevant image is found, refine the query with more specific details or ask the user for clarification.",
        "options": {}
      },
      "type": "n8n-nodes-agent-brains.agentBrainsTool",
      "typeVersion": 1,
      "position": [
        256,
        592
      ],
      "id": "3f5a27c9-8e78-45a2-9cc5-a75cd4cb25cd",
      "name": "find_relevant_image",
      "credentials": {
        "agentBrainsIntegrationApi": {
          "id": "OXX19UWa1c40zWVn",
          "name": "Demo Key"
        }
      }
    },
    {
      "parameters": {
        "operation": "getByCategoryAlias",
        "returnAll": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-agent-brains.agentBrainsTool",
      "typeVersion": 1,
      "position": [
        528,
        592
      ],
      "id": "d807ca12-19fc-45bd-8732-5fd4bb928198",
      "name": "get_current_prices_and_promos",
      "credentials": {
        "agentBrainsIntegrationApi": {
          "id": "OXX19UWa1c40zWVn",
          "name": "Demo Key"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('AgentBrains Trigger').item.json.data.message }}",
        "options": {
          "systemMessage": "=**Role:**\n{{ $('AgentBrains Trigger').item.json.data.custom.role }}\n\n\n**Tonality:**\n{{ $('AgentBrains Trigger').item.json.data.custom.tonality }}\n\n\n**Tools:**\n- You MUST use the \"search_knowledge_base\" tool before answering ANY question.\n- You MUST use the \"find_relevant_image\" tool before answering ANY question.\n- You MUST use the \"get_current_prices_and_promos\" tool whenever a user asks about prices, costs, discounts, sales, promo codes, or any promotional offers.\n\n\n**Format output:**\nOutput the answer in Markdown format. Use ![Image](<url-of-image>) to insert relevant images.\n\n\n**Primary goal:**\nHelp customers fully resolve their issues inside the chat using clear instructions and expert knowledge.\n\n\n**Today is:** {{ $now }}\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        16,
        208
      ],
      "id": "d45f40e9-19dc-41b4-8b32-b04621f8e42b",
      "name": "Website assistant",
      "retryOnFail": true,
      "waitBetweenTries": 2000
    },
    {
      "parameters": {
        "responseMode": "lastNode",
        "options": {}
      },
      "type": "n8n-nodes-agent-brains.integrationTrigger",
      "typeVersion": 1,
      "position": [
        -288,
        208
      ],
      "id": "1d1da1dc-f116-46a3-a84f-9932491e947a",
      "name": "AgentBrains Trigger",
      "webhookId": "7ac3ac4b-d858-4da9-941d-cd34282ffd75",
      "credentials": {
        "agentBrainsIntegrationApi": {
          "id": "OXX19UWa1c40zWVn",
          "name": "Demo Key"
        }
      }
    },
    {
      "parameters": {
        "content": "### Agent Brains Trigger Node\n\n### Add this node to create a new Agent Brains employee with the same name as the workflow.\n\nThis node is executed every time a user sends a message to the bot or a conversion completes.\n\n\n\n\n\n",
        "height": 320,
        "width": 352,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        32
      ],
      "typeVersion": 1,
      "id": "d0ff359e-0589-471a-994d-ca87b07db5ef",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "content": "### Final Output Formatting\n\nTakes the final text (which includes the Markdown formatting and embedded image URL from the tools) and wraps it into a JSON with attribute `message`.\n\nThis is sent back to the webhook trigger as a clean response.",
        "height": 332,
        "width": 317,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        432,
        32
      ],
      "id": "057dc84f-adf9-48c0-a18a-ed00f3eac86c",
      "name": "Sticky Note 4"
    },
    {
      "parameters": {
        "content": "## Agent Brains Knowledge Base Tool\n\nEnable agents to access complete information from the knowledge base.\nSome sensitive data is best accessed in its entirety for a more accurate response.\n",
        "height": 352,
        "width": 432,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        432,
        400
      ],
      "id": "2516cf6e-dd24-4153-9b11-98b3b3d062ff",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "## Agent Brains RAG Tool\n\nEnable agents to access vectorized information. This can be either text or images.",
        "height": 288,
        "width": 400,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        464
      ],
      "id": "186c03d0-2e3e-45a3-ab5c-30865ede2080",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -336,
        528
      ],
      "id": "881184f9-358d-4a90-b8eb-8a2ca786ccd1",
      "name": "Google Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "xcWLC3esEOzPhBn0",
          "name": "Google Gemini DEMO"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Website assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "search_knowledge_base": {
      "ai_tool": [
        [
          {
            "node": "Website assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "find_relevant_image": {
      "ai_tool": [
        [
          {
            "node": "Website assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_current_prices_and_promos": {
      "ai_tool": [
        [
          {
            "node": "Website assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Website assistant": {
      "main": [
        [
          {
            "node": "response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AgentBrains Trigger": {
      "main": [
        [
          {
            "node": "Website assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Website assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "2003d2f8-e0fa-4621-aa53-445b403e91a7",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "3cd2afbf7c8d48879c5fac1fab7c9add61152ad0c0997bde291f08e69f0889e5"
  },
  "id": "kyUjaP91kb3qyu0TqUvLb",
  "tags": []
}