{
  "name": "🤖 Email Agent",
  "nodes": [
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -260,
        0
      ],
      "id": "d31da9bf-eef9-4c33-bd51-fcc014114771",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.query }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        220,
        0
      ],
      "id": "769723a2-3f91-4e73-bec1-c01e8584d1d1",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        60,
        300
      ],
      "id": "cb9d501d-2314-4319-9d27-df27278f71b4",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "nrDrI8MUFREwh9aM",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}"
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        460,
        280
      ],
      "id": "0a083353-5ada-405e-9b7e-18b502e94341",
      "name": "Get",
      "webhookId": "23cab367-2fde-469c-90c0-7422b3e3029a",
      "credentials": {
        "gmailOAuth2": {
          "id": "YFxurHpjWaABxhWI",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        220,
        280
      ],
      "id": "8784ca2c-ffee-4733-bce0-cbf229fa0712",
      "name": "Send",
      "webhookId": "226ae793-e628-45cc-82e8-ac231523372d",
      "credentials": {
        "gmailOAuth2": {
          "id": "YFxurHpjWaABxhWI",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "limit": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Limit', ``, 'number') }}",
        "simple": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Simplify', ``, 'boolean') }}",
        "filters": {
          "readStatus": "unread"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        340,
        280
      ],
      "id": "74170ca5-208b-488f-a42f-90ade5fb2a45",
      "name": "Search",
      "webhookId": "3cee156b-6a90-42a8-a594-cfa521b967c5",
      "credentials": {
        "gmailOAuth2": {
          "id": "YFxurHpjWaABxhWI",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "reply",
        "messageId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        580,
        280
      ],
      "id": "b0afe050-2512-468a-b83b-fba815349885",
      "name": "Reply",
      "webhookId": "f967c0e5-c3c5-4934-8d65-3b6e6da10444",
      "credentials": {
        "gmailOAuth2": {
          "id": "YFxurHpjWaABxhWI",
          "name": "Gmail account"
        }
      }
    }
  ],
  "pinData": {
    "When Executed by Another Workflow": [
      {
        "json": {
          "query": "Reply to Leon. Tell him we're on for Friday."
        }
      }
    ]
  },
  "connections": {
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Search": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Reply": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1581dfb2-f629-4bd5-b6da-98d5794d48c6",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "cd8f3260f4f840103c2ad768fc0a1d92f91d8588e163407d3747cc2f7c516a5a"
  },
  "id": "dTz60sOyMjxoI43Z",
  "tags": []
}