{
  "name": "Calendar Agent Demo",
  "nodes": [
    {
      "parameters": {},
      "id": "de2971ae-36df-483a-94ca-f9c586d62f43",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        360,
        300
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "05e82744-639a-48ef-8862-cdbcbb2c5e7b",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        480,
        520
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "nateherk88@gmail.com",
          "mode": "list",
          "cachedResultName": "nateherk88@gmail.com"
        },
        "start": "={{ $fromAI(\"startTime\") }}",
        "end": "={{ $fromAI(\"endTime\") }}",
        "additionalFields": {
          "summary": "={{ $fromAI(\"eventTitle\") }}"
        }
      },
      "id": "6a32f5a0-b664-4f6f-8ea3-a0a07eed0800",
      "name": "Create Event",
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.2,
      "position": [
        600,
        520
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "nateherk88@gmail.com",
          "mode": "list",
          "cachedResultName": "nateherk88@gmail.com"
        },
        "start": "={{ $fromAI(\"startTime\") }}",
        "end": "={{ $fromAI(\"endTime\") }}",
        "additionalFields": {
          "attendees": [
            "={{ $fromAI(\"attendee\") }}"
          ],
          "summary": "={{ $fromAI(\"eventTitle\") }}"
        }
      },
      "id": "e077fd4b-9929-4806-ac2a-6d08dd165942",
      "name": "Create Event with Attendee",
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.2,
      "position": [
        720,
        520
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "nateherk88@gmail.com",
          "mode": "list",
          "cachedResultName": "nateherk88@gmail.com"
        },
        "returnAll": true,
        "options": {
          "timeMin": "={{ $fromAI(\"ondDayBefore\",\"one day before the date the user requested\") }}",
          "timeMax": "={{ $fromAI(\"ondDayAfter\",\"one day after the date the user requested\") }}"
        }
      },
      "id": "45cc702e-7e81-4ed2-ab31-cd597e2855b4",
      "name": "Get Events",
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.2,
      "position": [
        840,
        520
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "db40c217-79fb-4e81-a798-d8899176af18",
              "name": "response",
              "value": "={{ $json.output }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "9b574378-2977-460e-9ee2-d311e84f8701",
      "name": "Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        960,
        300
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.query }}",
        "options": {
          "systemMessage": "=You are a calendar assistant. You have access to multiple tools to take any action within calendar. Here is the current date/time: {{ $now }}\n\nCreate Event:\nIf an end date isn't specified for the event, assume it will be 60 minutes long. Use this tool if there is no attendee specified.\n\nCreate Event with Attendee:\nIf an end date isn't specified for the event, assume it will be 60 minutes long. Use this tool WHEN AN ATTENDEE IS SPECIFIED.\n\nGet Events:\nUse this tool to get events from a certain day and summarize them. "
        }
      },
      "id": "7d4affc7-8176-45cd-abd0-1c9e4609c6de",
      "name": "Calendar Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        580,
        300
      ]
    }
  ],
  "connections": {
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Calendar Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Event": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Event with Attendee": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Events": {
      "ai_tool": [
        [
          {
            "node": "Calendar Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calendar Agent": {
      "main": [
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b1146f9c-ba8a-4012-911f-ebd7f521e001",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Rd2MEWOkNMSQYjQi",
  "tags": []
}