{
  "nodes": [
    {
      "id": "db5520a2-c423-406b-9150-0cf4a0f99ed2",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        -832,
        -48
      ],
      "parameters": {
        "options": {
          "messageStatusUpdates": []
        },
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "050596e5-1c80-4dd1-984f-199394653f6c",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        736,
        -192
      ],
      "parameters": {
        "text": "=You are  a helpful and friendly AI assistant. The user seems emotionally neutral, so reply in a calm, polite, slightly playful way. \n\nIMPORTANT FORMATTING RULES (Strict): Do NOT use more than one question mark total in your entire reply. Use '..' instead of '?' inside sentences or casual questions. Only the final sentence may end with a question, and only if it is a real question.\n\n{{ $now }}\n\nuser message: {{ $json.input }}\n\n",
        "options": {
          "systemMessage": "=\ud83d\udee0\ufe0f Instructions for Agent Behavior\n\nContext Retrieval\n\nFirst, search the vector store for relevant past user conversations or data.\n\nIf no useful context is found, query the Supabase Vector tool.\n\nRetry the vector store once if the first attempt fails.\n\nIf still no context is found, continue naturally without it.\n\nImage Requests\n\nIf the user asks to create, generate, or send an image, logo, or any other picture, use the HTTP node to send the user\u2019s message for image creation.\n\nCalendar & Task Handling\n\nIf the user asks about tasks, reminders, plans, or appointments, use the Calendar and Task agents to create them.\n\nIf the user asks about today\u2019s tasks, events, or plans, fetch information from both Calendar and Task agents, then inform the user.\n\nResearch & Wikipedia Logic\n\nFor factual, research-oriented, or up-to-date questions, use the Research tool.\n\nFor entertainment, history, or politics queries, use the Wikipedia tool.\n\nIf both tools apply, query both and merge the results before responding.\n\n---End of Instructions---"
        },
        "promptType": "define",
        "needsFallback": true
      },
      "retryOnFail": true,
      "typeVersion": 2.1
    },
    {
      "id": "d849f985-fe50-442a-a574-a2c77bfa16ec",
      "name": "send chat history to MongoDB",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        -192
      ],
      "parameters": {
        "url": "https://n8n.iniyavan.space/webhook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "User's Message",
              "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}"
            },
            {
              "name": "Assistant's Response",
              "value": "={{ $('AI Agent1').item.json.output }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fa866ec1-ec7d-4f10-b376-7dbf960c3230",
      "name": "WeatherMap",
      "type": "n8n-nodes-base.openWeatherMapTool",
      "position": [
        960,
        16
      ],
      "parameters": {
        "cityName": "bengaluru",
        "operation": "5DayForecast"
      },
      "credentials": {
        "openWeatherMapApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "740c0b36-e4c8-47b2-898c-c6422dea0f68",
      "name": "Download media",
      "type": "n8n-nodes-base.whatsApp",
      "onError": "continueRegularOutput",
      "position": [
        -384,
        -144
      ],
      "parameters": {
        "resource": "media",
        "operation": "mediaUrlGet",
        "mediaGetId": "={{ $json.messages[0].image.id }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "10ff9ba4-f689-490c-bffc-e85fb1b5b110",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "onError": "continueRegularOutput",
      "position": [
        64,
        -144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.0-flash",
          "cachedResultName": "models/gemini-2.0-flash"
        },
        "options": {},
        "resource": "image",
        "inputType": "binary",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b47e8952-813e-4133-91cc-0b06f7e172ed",
      "name": "HTTP Request5",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -160,
        -144
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "whatsAppApi"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        },
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "88d4f859-563c-4544-86c1-e1cb9aa0de6a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -608,
        -48
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f843ef78-7ddf-43b3-8d6c-7969529566a1",
                    "operator": {
                      "type": "object",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.messages[0].image }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "chat",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "844825ff-91be-472c-82ba-e7c22d3c988a",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{    $json.messages[0].text?.body || ''  }} ",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "df58f83c-abc9-43fc-8935-552a058ec9ea",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1248,
        32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d3ca2d52-0656-46bd-8e62-149ed91de187",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        256,
        -64
      ],
      "parameters": {
        "jsCode": "const image = $json.content?.parts?.[0]?.text\n  ? '(Result: ' + $json.content.parts[0].text + ') \u2014 This is the result from the image analysis node of the user message. Reply accordingly. If it\u2019s technical, elaborate the message and reply with the input.'\n  : '';\n\nconst whatsappNode = $('WhatsApp Trigger').first().json;\nconst text = whatsappNode?.messages?.[0]?.text?.body || '';\n\nconst input = image || text;\n\nif (!input) {\n  throw new Error(\"No input available from image or text.\");\n}\n\nreturn [\n  {\n    json: {\n      input,\n      source: image ? \"image\" : (text ? \"text\" : \"none\"),\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6e48d0a9-804b-4ec1-b9fc-11b30677319e",
      "name": "Gmail tool",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        144,
        336
      ],
      "parameters": {
        "text": "use the Gmail tools to get the recent emails for every request.",
        "options": {
          "systemMessage": ""
        },
        "needsFallback": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "7f58a1fa-7c17-499a-a84b-108e71cf9128",
      "name": "Typing....",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -416,
        48
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v22.0/{{ $json.metadata.phone_number_id }}/messages ",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"status\": \"read\",\n  \"message_id\": \"{{ $json.messages[0].id }}\",\n  \"typing_indicator\": {\n    \"type\": \"text\"\n  }\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {}
          ]
        },
        "nodeCredentialType": "whatsAppApi"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b1af98a9-b2e9-4548-9e4e-538bc09bd7b7",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        512,
        336
      ],
      "parameters": {
        "sessionKey": "whatsapp",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0a47aecd-cfa8-44c9-9b28-e1edbc5cc8c2",
      "name": "Calendar Agent",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        -528,
        368
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "=# Overview\nYou are a calendar assistant. Your responsibilities include creating, getting, and deleting events in the user's calendar.\n\n**Calendar Management Tools**  \n   - Use \"Create Event with Attendee\" when an event includes a participant.  \n   - Use \"Create Event\" for solo events.   \n   - Use \"Get Events\" to fetch calendar schedules when requested.\n   - Use \"Delete Event\" to delete an event. You must use \"Get Events\" first to get the ID of the event to delete.\n   - Use \"Update Event\" to update an event. You must use \"Get Events\" first to get the ID of the event to update.\n\nIf the user asks about tasks, reminders, plans, or appointments, use the Calendar and Task agents to create them.\n\nIf the user asks about today\u2019s tasks events or plans, fetch and inform them using both Calendar and Task Agents.\n\n## Final Notes\nHere is the current date/time: {{ $now }}\nIf a duration for an event isn't specified, assume it will be one hour."
        },
        "toolDescription": "A calendar agent for all calendar actions"
      },
      "typeVersion": 2.2
    },
    {
      "id": "f02dc89a-9538-4f3d-9b6c-4ec80f71ba55",
      "name": "Get many events",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -640,
        576
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "Reminders"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "da372f07-f4df-4f60-bb7f-7eb97d30fe95",
      "name": "Create an event",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -512,
        576
      ],
      "parameters": {
        "end": "={{ $fromAI('End', ``, 'string') }}",
        "start": "={{ $fromAI('Start', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "Reminders"
        },
        "additionalFields": {
          "summary": "={{ $fromAI('Summary', ``, 'string') }}"
        }
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "8f94949d-1381-4729-ae31-a060644cd69a",
      "name": "Update an event",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -384,
        576
      ],
      "parameters": {
        "eventId": "={{ $fromAI('Event_ID', ``, 'string') }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "Reminders"
        },
        "operation": "update",
        "updateFields": {}
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "fb8c7351-c381-46d5-8a74-f3e4a1f0e2c9",
      "name": "Delete an event",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -256,
        576
      ],
      "parameters": {
        "eventId": "={{ $fromAI('Event_ID', ``, 'string') }}",
        "options": {},
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "Reminders"
        },
        "operation": "delete"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "22ddc16f-9aa4-4967-84fc-f27239cc6e4e",
      "name": "Get an event",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -128,
        576
      ],
      "parameters": {
        "eventId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Event_ID', ``, 'string') }}",
        "options": {},
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "Reminders"
        },
        "operation": "get"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5380aa75-09f4-44bc-a37e-142f4816e685",
      "name": "MongoDB Atlas Vector Store2",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        640,
        224
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 5,
        "options": {},
        "metadata_field": " info, text, summary",
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "document",
          "cachedResultName": "document"
        },
        "toolDescription": "use this tool as memory node for the Ai agent ",
        "vectorIndexName": "default"
      },
      "credentials": {
        "mongoDb": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b33fcdb6-99ba-44f2-b6ab-070e53bf720c",
      "name": "gemini-2.5-flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        16,
        528
      ],
      "parameters": {
        "options": {},
        "modelName": "=models/gemini-2.5-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "32461746-2727-4c06-95ee-6aa60e613c32",
      "name": "gpt-5-nano",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        144,
        544
      ],
      "parameters": {
        "model": "=openai/gpt-5-nano",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "23cf2e5a-e1cf-45cf-be5b-bd8d4027b86d",
      "name": "Get many messages",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        416,
        544
      ],
      "parameters": {
        "filters": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1f8a17f4-e027-4fb6-bfc3-1c63bf912097",
      "name": "Get a message",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        256,
        544
      ],
      "parameters": {
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c4c0cad1-33af-4f13-9e6b-e5e6f2559990",
      "name": "Task agent",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        -592,
        720
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "=You are a task management assistant. Your responsibilities include creating, retrieving, updating, and deleting tasks in the user's Google Tasks list.\n\nGoogle Tasks Management Tools\n\nUse \"Create Task\" to add a new task to the user's task list.\nUse \"Get Tasks\" to retrieve tasks from a specific list or all lists.\nUse \"Update Task\" to modify an existing task. You must use \"Get Tasks\" first to obtain the task ID.\nUse \"Delete Task\" to remove a task. You must use \"Get Tasks\" first to obtain the task ID.\nUse \"Create Task List\" to organize tasks into a new list.\nUse \"Get Task Lists\" to retrieve available task lists.\nUse \"Delete Task List\" to remove an entire task list. You must use \"Get Task Lists\" first to obtain the list ID.\n\nFinal Notes\nHere is the current date/time: {{ $now }}\nIf a due date or time is not specified for a task, assume it is due by end of day.\nTasks should be created with clear titles and optional descriptions for context.\nUse priority flags if specified (e.g., high, medium, low)."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "26f8949b-1876-42dd-a4b2-e79e5e6723ee",
      "name": "Create a task in Google Tasks",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        -528,
        880
      ],
      "parameters": {
        "task": "MDE5MTI4ODM0MjI0MDM1MTAyNDQ6MDow",
        "title": "={{ $fromAI('Title', ``, 'string') }}",
        "additionalFields": {}
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0e3279da-25b6-4245-9102-a41b72e692bb",
      "name": "Delete a task in Google Tasks",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        -336,
        896
      ],
      "parameters": {
        "task": "MDE5MTI4ODM0MjI0MDM1MTAyNDQ6MDow",
        "taskId": "={{ $fromAI('Task_ID', ``, 'string') }}",
        "operation": "delete"
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1749a2e0-f4fa-4309-86c8-f0a8b8b0424e",
      "name": "Get many tasks in Google Tasks",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        -144,
        880
      ],
      "parameters": {
        "task": "MDE5MTI4ODM0MjI0MDM1MTAyNDQ6MDow",
        "operation": "getAll",
        "additionalFields": {
          "dueMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Due_Max', ``, 'string') }}",
          "dueMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Due_Min', ``, 'string') }}"
        }
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "82bed5ea-6807-42db-a0ac-3fa25fc163e5",
      "name": "image creation",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1120,
        32
      ],
      "parameters": {
        "url": "https://n8n.iniyavan.space/webhook/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "user message:",
              "value": "={{ $('WhatsApp Trigger').item.json.messages[0].text.body }}"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "2da1edbd-f7a7-484a-86a7-6499bacfd439",
      "name": "Brave Search",
      "type": "@brave/n8n-nodes-brave-search.braveSearchTool",
      "position": [
        1520,
        896
      ],
      "parameters": {
        "count": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Count', ``, 'number') }}",
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}"
      },
      "credentials": {
        "braveSearchApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "68a9d8d1-7e31-4d97-a2db-6adf8950adb3",
      "name": "Brave Search1",
      "type": "@brave/n8n-nodes-brave-search.braveSearchTool",
      "position": [
        1648,
        896
      ],
      "parameters": {
        "count": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Count', ``, 'number') }}",
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "operation": "news"
      },
      "credentials": {
        "braveSearchApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "455f2427-d9db-4936-849e-5afc3b05cc85",
      "name": "gpt-4.1-nanoChat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        960,
        880
      ],
      "parameters": {
        "model": "openai/gpt-5-nano",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5e3b3446-88b2-4eb5-a853-e61169ac9bcd",
      "name": "Research agent",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        1168,
        704
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "={\n  \"overview\": \"You are a web research assistant. Your responsibilities include conducting quick web searches, performing deeper research, and retrieving current weather information.\",\n  \"rules\": {\n    \"query_gap\": \"Ensure there is at least a 1 second delay between any queries sent to Brave Web and Brave News.\"\n  },\n  \"capabilities\": {\n    \"web_search_and_research\": {\n      \"wikipedia\": \"Use for quick factual lookups, background context, or verifying specific details.\",\n      \"perplexcia\": \"Use for deeper research requiring multiple perspectives, synthesis across sources, or long-form reasoning.\",\n      \"tavily\": \"Use for structured, concise, API-driven search results that directly answer the query.\",\n      \"brave\": {\n        \"description\": \"Use Brave Search for independent, real-time web searches and discovery of current content.\",\n        \"strengths\": [\n          \"Unbiased results from its own index (not Google/Bing).\",\n          \"Ideal for breaking news, time-sensitive events, and recent developments.\",\n          \"Useful for competitive analysis, market research, and trend monitoring.\",\n          \"Supports web, news, images, and video categories.\"\n        ],\n        \"tools\": {\n          \"brave_web\": \"Use for broad and real-time web searches.\",\n          \"brave_news\": \"Use specifically for fresh news, breaking updates, and trending topics.\"\n        }\n      }\n    },\n    \"weather_information\": {\n      \"open_weather_map\": \"Retrieve current weather data including temperature, conditions, and forecasts for a given location.\"\n    }\n  },\n  \"execution_order\": {\n    \"factual_or_background\": [\n      \"wikipedia\",\n      \"tavily\",\n      \"perplexcia\"\n    ],\n    \"recent_or_time_sensitive\": [\n      \"brave_news\",\n      \"brave_web\",\n      \"tavily\"\n    ],\n    \"deep_research\": [\n      \"perplexcia\",\n      \"tavily\",\n      \"brave_web\"\n    ],\n    \"weather_queries\": [\n      \"open_weather_map\"\n    ],\n    \"notes\": [\n      \"Always prefer Wikipedia first for simple factual queries.\",\n      \"For breaking news, start with Brave News, then Brave Web if more coverage is needed.\",\n      \"For broader search, Brave Web is prioritized before Tavily.\",\n      \"Use Perplexcia last unless deep reasoning or synthesis is required.\",\n      \"Always enforce a 1 second gap when using Brave Web and Brave News together.\"\n    ]\n  }\n}\n"
        },
        "needsFallback": true
      },
      "executeOnce": true,
      "typeVersion": 2.2
    },
    {
      "id": "65f6dbf8-207e-4460-9d42-04412f4afd57",
      "name": "perprlexcia",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1104,
        896
      ],
      "parameters": {
        "url": "http://selfhosted perplexicia link/api/search",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ $fromAI('parameters0_Value', ``, 'string') }}"
            },
            {
              "name": "focusMode",
              "value": "webSearch"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "executeOnce": false,
      "typeVersion": 4.2
    },
    {
      "id": "dc2bd811-0c98-488f-9e41-95b882367030",
      "name": "Wikipedia",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        1232,
        896
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c14c9d29-7c6d-4459-bd6f-d251b66328cf",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -496
      ],
      "parameters": {
        "color": 4,
        "width": 2768,
        "height": 1552,
        "content": "## Main Workflow: The core engine that listens for WhatsApp messages and delegates tasks to the appropriate AI agent or tool.\n**This workflow transforms your WhatsApp into a powerful, multi-talented AI assistant. \nIt's designed to handle a wide range of tasks by understanding user messages, analyzing images, and connecting to various external tools and services.\nThe assistant can hold natural conversations, remember past interactions using a MongoDB vector store (RAG), and decide which tool is best suited for a user's request. \nWhether you need to check your schedule, research a topic, get the latest news, create an image, or even analyze a picture you send, this workflow orchestrates it all seamlessly through a single WhatsApp chat interface.** "
      },
      "typeVersion": 1
    },
    {
      "id": "653a955e-4b6f-485d-b366-d3ab3c32210d",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        928,
        1472
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "483c6a74-46cb-4597-8b60-e42acb71106e",
      "name": "Extract Memory Info",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -16,
        1248
      ],
      "parameters": {
        "text": "=Analyze the following conversation turn. Your goal is to extract any new, important, and non-obvious information that should be remembered for future conversations. This includes personal facts, preferences, goals, or key context.\n\n--- CONVERSATION TURN ---\nUser's Message:{{ $json.body['User\\'s Message'] }}\n\nAssistant's Response:{{ $json.body['Assistant\\'s Response'] }}\n\n--- END OF TURN ---\n\nIf there is significant information worth remembering, provide a concise, third-person summary of that information (e.g., \"The user's favorite color is blue.\").\n\nIf there is nothing new or important to remember, you MUST return the single word: nothing",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "14bf21ee-f158-4e1f-a703-b24483f7a798",
      "name": "Check If Worth Remembering",
      "type": "n8n-nodes-base.if",
      "position": [
        336,
        1248
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.text.toLowerCase() }}",
              "value2": "nothing",
              "operation": "notEqual"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "26687cab-4c9c-49a7-822a-c129e99a78cd",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        1248
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5e434ab2-be7f-492a-bee1-8dfe8caf674a",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now }}"
            },
            {
              "id": "26cb2b49-ade5-4d9b-bbfd-598afd4847ad",
              "name": "userID",
              "type": "string",
              "value": "=582202219"
            },
            {
              "id": "4d570a8c-33f5-4f99-ab1b-77adadcce89a",
              "name": "info",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "a24cb0ae-b069-4962-80e9-02eec77b90f6",
              "name": "user_message",
              "type": "string",
              "value": "={{ $('Webhook2').item.json.body[\"User's Message\"] }}"
            },
            {
              "id": "3901d073-46e5-4490-878a-5d48fcc857e7",
              "name": "assistant_response",
              "type": "string",
              "value": "={{ $('Webhook2').item.json.body[\"Assistant's Response\"] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "17921c4e-2f85-45cb-a9a2-87cf3102c8ce",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        64,
        1472
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e338e874-e82c-4e96-a44e-dc5e75bafce3",
      "name": "Webhook2",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -240,
        1248
      ],
      "parameters": {
        "path": "a0299e2f-a81b-48e0-a912-d9749ecf1820",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "80ce8220-3ba0-44d5-82e1-cdc0c2f995f3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        1152
      ],
      "parameters": {
        "color": 4,
        "width": 2128,
        "height": 592,
        "content": "## Memory Webhook: A dedicated workflow that processes conversation history, extracts key information, and stores it in a vector database for long-term memory."
      },
      "typeVersion": 1
    },
    {
      "id": "a025ca0b-87c3-41e0-b6c1-1605c486c0bc",
      "name": "Webhook3",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -592,
        1920
      ],
      "parameters": {
        "path": "92db4287-145c-4ae7-9931-ab57b4ecbe67",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "0e9c89e7-9ee9-464b-a6ac-fc757bdd2ebd",
      "name": "Edit Fields5",
      "type": "n8n-nodes-base.set",
      "position": [
        448,
        1936
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8ee5a866-7fe1-45be-8e1a-60a13ee3fbf8",
              "name": "base64",
              "type": "string",
              "value": "={{ $json.data[0].b64_json }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "650587b4-e984-457c-9419-016529e05034",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        672,
        1936
      ],
      "parameters": {
        "options": {},
        "operation": "toBinary",
        "sourceProperty": "base64"
      },
      "typeVersion": 1.1
    },
    {
      "id": "25a7325a-3d78-477d-aed6-1922a9758964",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        1936
      ],
      "parameters": {
        "url": "https://api.together.xyz/v1/images/generations",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"black-forest-labs/FLUX.1-schnell\",\n  \"prompt\": \"{{ $json.cleanedPrompt }}\",\n  \"width\": 1024,\n  \"height\": 768,\n  \"steps\": 4,\n  \"n\": 1,\n  \"response_format\": \"b64_json\",\n  \"stop\": []\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1db6b6a3-0715-4545-b9ce-ef49e484323d",
      "name": "Clean Prompt Text1",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        1936
      ],
      "parameters": {
        "jsCode": "let input = $input.first().json.output || '';\n\nconsole.log('Original input:', input);\n\n// Remove ALL quotes (both single and double)\nlet cleanedInput = input.replace(/['\"]+/g, '');\n\n// Clean whitespace (replace multiple spaces with single space)\ncleanedInput = cleanedInput.replace(/\\s+/g, ' ').trim();\n\nconsole.log('Final cleaned input:', cleanedInput);\n\n// Return cleaned prompt\nreturn { cleanedPrompt: cleanedInput };"
      },
      "typeVersion": 2
    },
    {
      "id": "70fea3dd-1d12-4549-9fcb-b221fa90e9dd",
      "name": "Summarize Chat",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1120,
        1936
      ],
      "parameters": {
        "text": "=Summarize the following exchange in 1 human-readable sentence.\nNote the conversation may in tamil,engilsh or Both (Thunglish). User is male and it always one-to-one convo.\nUSER:{{ $('Webhook3').item.json.body['user message:'] }}\nASSISTANT: {{ $('AI Agent').item.json.output }}\n\nWrite a warm, human-style summary.\nIf the message is trivial or small talk, just return: nothing.\n\n",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "866d2679-1701-44d3-a287-587ee7e55594",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        1840
      ],
      "parameters": {
        "color": 4,
        "width": 2128,
        "height": 656,
        "content": "## Image Generation Webhook: A specialized workflow triggered when a user asks to create an image, which processes the request, generates the image using an external API, and sends it back to the user."
      },
      "typeVersion": 1
    },
    {
      "id": "be62742c-4f35-4c22-b325-6f922375700f",
      "name": "Google Gemini Chat Model5",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        320,
        2320
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-lite"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e5f68156-d7e4-424c-ac52-2f0c7e3406eb",
      "name": "Send message3",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        896,
        1936
      ],
      "parameters": {
        "mediaPath": "useMedian8n",
        "operation": "send",
        "messageType": "image",
        "phoneNumberId": "=",
        "additionalFields": {},
        "recipientPhoneNumber": "="
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "201f19c6-b148-45dc-926e-c562ff63c485",
      "name": "MongoDB Atlas Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        784,
        1248
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "metadata_field": "=info",
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "document",
          "cachedResultName": "document"
        },
        "vectorIndexName": "default"
      },
      "credentials": {
        "mongoDb": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "063b74a7-89f8-479b-88c4-0a4d6fc1e3ca",
      "name": "MongoDB Atlas Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        -32,
        2176
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 5,
        "options": {},
        "metadata_field": " info, text, summary",
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "document",
          "cachedResultName": "document"
        },
        "toolDescription": "use this tool as memory node for the Ai agent ",
        "vectorIndexName": "default"
      },
      "credentials": {
        "mongoDb": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "9429d89e-2dfa-4ba1-9364-54f256612749",
      "name": "gpt-4.1-nano",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        -480,
        2144
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "af220466-31a3-40c8-9ffc-d26e6d3546c5",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -336,
        1936
      ],
      "parameters": {
        "text": "=You are AI assistant specializing in image creation.\n\nIMPORTANT:\nAlways use the MongoDB Atlas Vector Store tool to retrieve the most relevant memory based on the \nuser\u2019s message.\nFirst, search the vector store for the latest summarized conversation or any related past memory.\nIf the memory node returns no data, use the tool node again to attempt retrieval.\nIf no relevant memory is found after retrying, proceed without additional context.\n\nUSER'S LATEST MESSAGE:{{ $json.body['user message:'] }}\nBased on the above conversation context, generate a detailed image generation prompt that best fulfills the user's request.  The prompt should be suitable for a state-of-the-art image generation model (e.g., DALL-E 3, Midjourney).\n\nThe generated prompt should include:\n\n*   A clear description of the subject matter.\n*   The desired style and artistic medium (e.g., photorealistic, painting, cartoon, sketch).\n*   Specific details regarding lighting, color palette, composition, and perspective.\n*   Any relevant artistic influences or references.\n\n\nOutput the image generation prompt only, without any introductory or conversational text. For example:  A photorealistic image of a majestic lion roaring on a mountaintop at sunset, with warm golden lighting and vibrant colors.",
        "options": {
          "systemMessage": "If user asked about his details use the tool to get his deatils"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "b8e315f0-df6d-45f7-bf62-9024ac54e064",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        -304
      ],
      "parameters": {
        "color": 7,
        "width": 1328,
        "height": 480,
        "content": "## WhatsApp Trigger & Download media\n**This is the entry point. The workflow starts when a message (text or image) is received via WhatsApp. \nThe Switch node then routes the message based on its content type. The Typing.... node sends a typing indicator to the user for a better experience.\n\nThis section processes the incoming message. If it's an image (Download media -> HTTP Request5 -> Analyze image), it's downloaded and analyzed by Gemini. If it's text, it's passed directly. The Code1 node standardizes the text and image analysis output into a single input for the main AI agent.**"
      },
      "typeVersion": 1
    },
    {
      "id": "27d99798-e05e-49e3-b607-a4ff58acb3c7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -320
      ],
      "parameters": {
        "color": 5,
        "width": 1168,
        "height": 512,
        "content": "## Core AI Agent\n**This is the brain of the operation. The AI Agent1 node receives the user's input, maintains short-term Simple Memory, and uses a powerful language model to decide which tool to use. It orchestrates all the other agents and tools.**"
      },
      "typeVersion": 1
    },
    {
      "id": "07289c78-16ec-4920-b658-37c61baa77a0",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        192
      ],
      "parameters": {
        "width": 1664,
        "height": 848,
        "content": "## Productivity Tools Agen\n\n**This group of nodes connects the assistant to your personal productivity suite. \nIt includes sub-agents and tools for managing `Google Calendar`, `Google Tasks`, and `Gmail`, \nallowing you to schedule events, manage to-dos, and read emails.**"
      },
      "typeVersion": 1
    },
    {
      "id": "7a667675-89b6-48c3-a561-1d4c1d1f8e08",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 432,
        "height": 304,
        "content": "## Memory"
      },
      "typeVersion": 1
    },
    {
      "id": "dae372fa-d531-42aa-a380-17b48e5ee9f0",
      "name": "codestral-embed-2505",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        656,
        368
      ],
      "parameters": {
        "model": "=codestral-embed-2505",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8bebd01d-5b2f-4403-8d46-384eb2aad1a2",
      "name": "codestral-embed-",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        800,
        1472
      ],
      "parameters": {
        "model": "=codestral-embed-2505",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a3481a80-f0bd-423e-a7b6-51d4bfe0e03e",
      "name": "codestral-embed-2506",
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "position": [
        96,
        2352
      ],
      "parameters": {
        "model": "=codestral-embed-2505",
        "options": {}
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b6377197-bec2-417a-939e-1aa6c50df842",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        512
      ],
      "parameters": {
        "width": 976,
        "height": 512,
        "content": "## Research Tool Agent\n**This agent handles all research-related queries. It has access to multiple search tools (`Brave Search`, `Wikipedia`, `Tavily`, and a custom Perplexity search) to find the most accurate and up-to-date information from the web.**"
      },
      "typeVersion": 1
    },
    {
      "id": "a8d68692-2753-4d79-a6b7-9dd11214c7e2",
      "name": "openai LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        448,
        32
      ],
      "parameters": {
        "model": "=openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "03ff077e-7c99-4aea-b731-ecaca82c9fbd",
      "name": "openai LLM1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        608,
        32
      ],
      "parameters": {
        "model": "=openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8f6697d6-6f46-4adf-956a-1319e1f1cd5e",
      "name": "openai/gpt-oss-120b",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        816,
        912
      ],
      "parameters": {
        "model": "=openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "30118025-a9c1-44d4-9e21-34bbc724d0eb",
      "name": "Tavily web search",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1376,
        896
      ],
      "parameters": {
        "url": "https://api.tavily.com/search",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer \"your API Key\""
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7d4a6069-1ec3-44cd-8993-35d61bedf1a3",
      "name": "openai/gpt-5-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        -720,
        864
      ],
      "parameters": {
        "model": "=openai/gpt-5-mini",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2a6d1bbd-1b48-451a-a5f8-b647c545c924",
      "name": "openai/gpt-5-mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatVercelAiGateway",
      "position": [
        -768,
        576
      ],
      "parameters": {
        "model": "=openai/gpt-5-mini",
        "options": {}
      },
      "credentials": {
        "vercelAiGatewayApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5e853092-1a3c-4588-a854-1595f8023f64",
      "name": "Send message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1184,
        -192
      ],
      "parameters": {
        "mediaPath": "useMedian8n",
        "operation": "send",
        "messageType": "image",
        "phoneNumberId": "=",
        "additionalFields": {},
        "recipientPhoneNumber": "="
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Code1": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Download media",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Typing....",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Clean Prompt Text1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook2": {
      "main": [
        [
          {
            "node": "Extract Memory Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook3": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Task agent": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Typing....": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WeatherMap": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "gpt-5-nano": {
      "ai_languageModel": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "openai LLM": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "openai LLM1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "perprlexcia": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Brave Search": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields5": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Edit Fields5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message": {
      "main": [
        [
          {
            "node": "send chat history to MongoDB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "gpt-4.1-nano": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Brave Search1": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get a message": {
      "ai_tool": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request5": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message3": {
      "main": [
        [
          {
            "node": "Summarize Chat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Calendar Agent": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Download media": {
      "main": [
        [
          {
            "node": "HTTP Request5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research agent": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Summarize Chat": {
      "main": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "image creation": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Send message3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many events": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update an event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "codestral-embed-": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "gemini-2.5-flash": {
      "ai_languageModel": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "ai_tool": [
        [
          {
            "node": "Gmail tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Tavily web search": {
      "ai_tool": [
        [
          {
            "node": "Research agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "openai/gpt-5-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Task agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Clean Prompt Text1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai/gpt-5-mini1": {
      "ai_languageModel": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "MongoDB Atlas Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Extract Memory Info": {
      "main": [
        [
          {
            "node": "Check If Worth Remembering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai/gpt-oss-120b": {
      "ai_languageModel": [
        [
          {
            "node": "Research agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "codestral-embed-2505": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "codestral-embed-2506": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "gpt-4.1-nanoChat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Research agent",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Memory Info",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model5": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize Chat",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check If Worth Remembering": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Atlas Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Atlas Vector Store2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create a task in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "Task agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete a task in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "Task agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many tasks in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "Task agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}