{
  "name": "Sub Calender Agent",
  "nodes": [
    {
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "id": "c9e4b6e3-9a1b-4080-83d8-58f664a2e5d1",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        -640,
        280
      ],
      "credentials": {
        "openAiApi": {
          "id": "mto8GpgTDXNCXksO",
          "name": "YT Test"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "7ab380a2-a8d3-421c-ab4e-748ea8fb7904",
              "name": "response",
              "value": "Unable to perform task. Please try again.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "dc3b5a31-1c29-4f0b-9cd8-913bcf9fc0cd",
      "name": "Try Again",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -120,
        80
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "39c2f302-03be-4464-a17a-d7cc481d6d44",
              "name": "=response",
              "value": "={{$json.output}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "6ea8ad28-24fd-4632-b0ba-a06542618750",
      "name": "Success",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -120,
        -100
      ]
    },
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -800,
        60
      ],
      "id": "ab6e3388-1993-4e63-ba9d-2172f8f77ef0",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "operation": "update",
        "calendar": {
          "__rl": true,
          "value": "arnio93@gmail.com",
          "mode": "list",
          "cachedResultName": "arnio93@gmail.com"
        },
        "eventId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Event_ID', `Die ID des Ereignisses.`, 'string') }}",
        "updateFields": {
          "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', `Der Endzeitpunkt des Ereignisses.`, 'string') }}",
          "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', `Der Startzeitpunkt des Ereignisses.`, 'string') }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        0,
        460
      ],
      "id": "5ac94b75-346b-45ba-a28d-e32484f2f70c",
      "name": "updateEvent",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "UM5avnmMmy6JghyJ",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "operation": "delete",
        "calendar": {
          "__rl": true,
          "value": "arnio93@gmail.com",
          "mode": "list",
          "cachedResultName": "arnio93@gmail.com"
        },
        "eventId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Event_ID', `Die ID des Ereignisses.`, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        140,
        440
      ],
      "id": "060261f1-5819-4a37-bcef-1b90018d9e50",
      "name": "deleteEvent",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "UM5avnmMmy6JghyJ",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "arnio93@gmail.com",
          "mode": "list",
          "cachedResultName": "arnio93@gmail.com"
        },
        "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', `Der Tag vor dem vom Nutzer gewünschten Datum.`, 'string') }}",
        "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', `Der Tag nach dem vom Nutzer gewünschten Datum.`, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        -320,
        440
      ],
      "id": "88eea132-7a56-48b2-b41c-20699ccd27aa",
      "name": "getEvents",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "UM5avnmMmy6JghyJ",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "arnio93@gmail.com",
          "mode": "list",
          "cachedResultName": "arnio93@gmail.com"
        },
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', `Der Startzeitpunkt des Ereignisses.`, 'string') }}",
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', `Der Endzeitpunkt des Ereignisses.`, 'string') }}",
        "additionalFields": {
          "attendees": [],
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', `Der Titel des Ereignisses.`, 'string') }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        -460,
        440
      ],
      "id": "73ae2d15-183c-43af-ad07-6fdc2394ed17",
      "name": "createEvent",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "UM5avnmMmy6JghyJ",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "arnio93@gmail.com",
          "mode": "list",
          "cachedResultName": "arnio93@gmail.com"
        },
        "start": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start', `Der Startzeitpunkt des Ereignisses.`, 'string') }}",
        "end": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('End', `Der Endzeitpunkt des Ereignisses.`, 'string') }}",
        "additionalFields": {
          "attendees": [
            "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Attendees', `Die Emailadresse des Teilnehmers.`, 'string') }}"
          ],
          "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', `Der Titel des Ereignisses.`, 'string') }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.3,
      "position": [
        -160,
        440
      ],
      "id": "1d4218ed-d383-436e-a782-1e8cec06f2dd",
      "name": "createEventWithAttendee",
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "UM5avnmMmy6JghyJ",
          "name": "Google Calendar account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.query }}",
        "options": {
          "systemMessage": "=# Role  \nYou are a calendar agent. Your tasks include creating, retrieving, and deleting events in the user's calendar.  \n\n# Tools  \n\n## getEvents  \nUse this tool to retrieve calendar schedules upon request.  \n\n## createEvent  \nUse this tool to create a solo appointment.  \n\n## updateEvent  \nUse this tool to update an event. You must first use **\"getEvents\"** to retrieve the ID of the event that needs to be updated.  \n\n## createEventWithAttendee  \nUse this tool to schedule an event with attendees.  \n\n## deleteEvent  \nUse this tool to delete an event. You must first use **\"getEvents\"** to retrieve the ID of the event that needs to be deleted.  \n\n  \ndate/time: **{{ $now }}**  \n"
        }
      },
      "id": "dbb3898e-a8dd-42ea-8a9b-0e126029ceda",
      "name": "Calender Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.6,
      "position": [
        -560,
        60
      ],
      "onError": "continueErrorOutput"
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Calender Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Calender Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "updateEvent": {
      "ai_tool": [
        [
          {
            "node": "Calender Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "deleteEvent": {
      "ai_tool": [
        [
          {
            "node": "Calender Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "getEvents": {
      "ai_tool": [
        [
          {
            "node": "Calender Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "createEvent": {
      "ai_tool": [
        [
          {
            "node": "Calender Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "createEventWithAttendee": {
      "ai_tool": [
        [
          {
            "node": "Calender Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calender Agent": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Try Again",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cded8cd6-a778-4b33-b495-9d9c282cae7e",
  "meta": {
    "instanceId": "89d6b5241e3d0c6b62682a09a72213abeeffd34a6110f442c15fc0b560f12919"
  },
  "id": "52lAjL1evSpdHmzO",
  "tags": []
}