{
  "name": "Email Agent",
  "nodes": [
    {
      "parameters": {},
      "id": "90492a45-6101-4307-baab-44f195c62000",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        440,
        80
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "id": "854e2c75-b464-4bfe-b958-b330830d585d",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        680,
        320
      ],
      "credentials": {
        "openAiApi": {
          "id": "hdRYPqX7PaZRro2X",
          "name": "OpenAi account 4"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "= {{ $fromAI('emailAddress', \"The receipient's email address\") }}",
        "subject": "={{ $fromAI('emailSubject') }}",
        "emailType": "text",
        "message": "={{ $fromAI('emailBody') }}",
        "options": {
          "appendAttribution": false,
          "senderName": "Damian"
        }
      },
      "id": "35ca8fc2-1648-4bc3-9b14-837616f05dad",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        880,
        360
      ],
      "webhookId": "cdf99f78-855f-4e09-af2f-637ab9981f40",
      "credentials": {
        "gmailOAuth2": {
          "id": "PkLmCcoTbwCOkTx7",
          "name": "Gmail account 3"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": "={{ $fromAI('limit') }}",
        "simple": false,
        "filters": {
          "sender": " {{ $fromAI('senderEmail') }}"
        },
        "options": {}
      },
      "id": "ca82f549-1c7f-453f-9270-f85da37229c4",
      "name": "Gmail1",
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        1020,
        360
      ],
      "webhookId": "9cb5abf2-f0e4-47ab-a965-0a4a0b9efe7e",
      "credentials": {
        "gmailOAuth2": {
          "id": "PkLmCcoTbwCOkTx7",
          "name": "Gmail account 3"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9cf98450-ed76-4877-b306-35351fae6ae8",
              "name": "response",
              "value": "={{ $json.output }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "9ef03c3d-fd5c-46da-afc0-7c009655dd6e",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1160,
        80
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.query }}",
        "options": {}
      },
      "id": "b48b1329-d85a-4f81-9816-500f443cd133",
      "name": "Email Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        780,
        80
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Email Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gmail": {
      "ai_tool": [
        [
          {
            "node": "Email Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail1": {
      "ai_tool": [
        [
          {
            "node": "Email Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Email Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d98c3e54-07ab-40d6-bf78-7ce21bdb4062",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "d1853d6d92799d2de46a947c80ac9a5af91665397cc93a1b568769b332366e37"
  },
  "id": "L0o7ERpJEcGhcLI6",
  "tags": []
}