{
  "id": "Zmia0j2r2xRgGc2J",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "My workflow",
  "tags": [],
  "nodes": [
    {
      "id": "ba7b6068-39e1-415b-9fd4-591304c2e37b",
      "name": "Google Calendar1",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        160,
        20
      ],
      "parameters": {
        "options": {},
        "timeMax": "={{ $fromAI(\"beforeDate\", \"This is the time user wants to search for the event past\") }}",
        "timeMin": "={{ $fromAI(\"afterDate\", \"This is the time user wants to search for the event past\") }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "testn8n"
        },
        "operation": "getAll"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e7fd1c3d-5f5c-4033-b9a9-5a97fa930a1c",
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        -60,
        80
      ],
      "parameters": {
        "end": "={{ $fromAI(\"endTime\",\"This is the end time of the event\") }}",
        "start": "={{ $fromAI(\"startTime\",\"This is the start time of the event\") }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "testn8n"
        },
        "additionalFields": {
          "summary": "={{ $fromAI(\"summary\",\"This is the summary/title of the event\") }}"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "78f963b1-2581-4106-96f8-9142319154d4",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -320,
        60
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "c78dad7d-0997-4ac8-b30d-9d8563665059",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -560,
        140
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "2dd0a798-19df-4579-899d-09d92be3a3ce",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -280,
        -200
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are a helpful assistant\n\nThe current date is {{ $now }}.\n\nYou are connected to a Google Calendar tool that lets you search for calendar events between two dates using the variables `afterDate` and `beforeDate` in ISO format (e.g., 2025-06-24T00:00:00Z). When the user asks for events, you must extract those fields and return them to the tool to make the query.\n"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "3a00ee73-ae8e-4913-b948-2ff2308b8775",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -580,
        -220
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "d6300f52-3c5f-47e8-9dce-2018f22b081d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -660,
        -300
      ],
      "parameters": {
        "height": 240,
        "content": "Send the prompt if we want to set the event on the calendar or get events available in the calendar"
      },
      "typeVersion": 1
    },
    {
      "id": "e48711cf-8484-42eb-950e-937baa5cee76",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -300
      ],
      "parameters": {
        "width": 360,
        "height": 220,
        "content": "Responsible for injecting the system prompt so things that are related for the project is only carried out. Also connects Gemini, Memory and calendar application together"
      },
      "typeVersion": 1
    },
    {
      "id": "cdb655b0-52e8-4335-9570-0b05b06418b1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        40
      ],
      "parameters": {
        "width": 220,
        "height": 240,
        "content": "Takes in the prompt and gives out the small event name based on the prompt"
      },
      "typeVersion": 1
    },
    {
      "id": "56b1989b-73e4-4548-a8ee-c0da3f1d8d9b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        60
      ],
      "parameters": {
        "height": 200,
        "content": "\n\n\n\n\n\n\n\n\nInbuilt memory for n8n which will store the value prompt received by AI agent so model can remember the conversation"
      },
      "typeVersion": 1
    },
    {
      "id": "bbfa4e3b-de8a-4453-ae33-7d656a0324a0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        60
      ],
      "parameters": {
        "width": 200,
        "height": 240,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\nCalendar node responsible for adding event in the calendar"
      },
      "typeVersion": 1
    },
    {
      "id": "90780243-d4a9-41f0-8359-4ed773198660",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -20
      ],
      "parameters": {
        "width": 200,
        "height": 240,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\nCalendar node responsible for getting all the events in asked timeframe"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d64ed07c-8f62-404c-84b2-80f4bac64809",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}