{
  "id": "BEJjQAqk5n3Yc0Q4",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "ca7ai Google_Calendar_workflow",
  "tags": [],
  "nodes": [
    {
      "id": "a0403acd-098a-491b-bf2b-0a55fac37560",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "2c770716-4b5c-491e-ab26-120b34452558",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are Albert, a helpful google calendar assistant. You are to use the \"sub_agent_cal\" to get calendar events, create calendar events, and delete calendar events."
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5cd09248-ed99-456e-8d66-9b81241aa1db",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        80,
        208
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0b829bdb-c01c-4985-baaf-61527793ada1",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        224,
        208
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "0aa51268-61c0-411b-bdd7-4fd2a241c895",
      "name": "sub_agent_cal",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        528,
        176
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "41tGOnU3hN9zjJln",
          "cachedResultName": "Google_Cal_sub_agent"
        },
        "description": "=This workflow helps to manager Google calendar events.",
        "workflowInputs": {
          "value": {
            "text": "={{ $json.chatInput }}",
            "session_id": "={{ $json.sessionId }}"
          },
          "schema": [
            {
              "id": "text",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "text",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "session_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "session_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "189828ba-266e-4c4b-8db0-6b9c0a2550ae",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 336,
        "height": 176,
        "content": "\ud83d\udfe2 PARENT \u2014 CHAT ENTRY\n\n**Trigger**: chat message\n**Persona**: Albert (calendar assistant)\n**Uses tool**: sub_agent_cal (Execute Workflow Tool)\n\nchatInput \u279c text, sessionId \u279c sessionid"
      },
      "typeVersion": 1
    },
    {
      "id": "c74d95ad-d8ad-4082-9ee3-bfa4effed6c8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        208
      ],
      "parameters": {
        "width": 336,
        "height": 112,
        "content": "\ud83d\udd17 ORCHESTRATION\n\n**Parent** = intent + memory\n**Child** = tools (Get / Create / Delete)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "99ffa58b-9bb1-4adb-a009-abc2d61ca3f7",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "sub_agent_cal": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}