This workflow follows the Agent → Documentdefaultdataloader recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "HelloAgent_n8nCase",
"nodes": [
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"filters": {}
},
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.3,
"position": [
368,
-160
],
"id": "46a534e3-3e72-4d0b-9a41-bc5c28834ee4",
"name": "Gmail",
"alwaysOutputData": false,
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
416,
32
],
"id": "882131ef-83bc-415f-9430-59d40503c4ae",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $('Gmail').item.json.threadId }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
544,
32
],
"id": "d230cedb-0a48-424f-8b79-4a5e8ae304a7",
"name": "Simple Memory"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.toolSerpApi",
"typeVersion": 1,
"position": [
672,
32
],
"id": "164578ff-9ef8-41ab-b4c3-22f7871c4885",
"name": "SerpAPI",
"credentials": {
"serpApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"sendTo": "={{ $('Gmail').item.json.From }}",
"subject": "=Re: {{ $('Gmail').item.json.Subject }}",
"message": "={{ $json.output }}",
"options": {}
},
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
928,
-160
],
"id": "c680c326-e4e1-41df-9f76-520c4b522618",
"name": "Send a message",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"mode": "insert",
"memoryKey": {
"__rl": true,
"value": "my-dailytime",
"mode": "list"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"typeVersion": 1.3,
"position": [
-16,
-160
],
"id": "ead1ed07-6e2c-4ba2-9d28-d5adf76540f1",
"name": "Simple Vector Store1"
},
{
"parameters": {
"modelName": "models/gemini-embedding-exp-03-07"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"typeVersion": 1,
"position": [
-32,
48
],
"id": "67402e5f-270b-4e31-9b48-4d2a2b60d79e",
"name": "Embeddings Google Gemini",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"typeVersion": 1.1,
"position": [
128,
48
],
"id": "e55e36f5-8628-496b-acb7-52a4f67b9af2",
"name": "Default Data Loader"
},
{
"parameters": {
"jsCode": "return [\n\n {\n \"doc_id\": \"work-schedule-001\",\n \"content\": \"\u6211\u7684\u5de5\u4f5c\u65f6\u95f4\u662f\u5468\u4e00\u81f3\u5468\u4e94\uff0c\u4e0a\u53489\u70b9\u5230\u4e0b\u53485\u70b9\u3002\u65f6\u533a\u662f\u6fb3\u5927\u5229\u4e9a\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\uff08AEST\uff09\u3002\"\n },\n {\n \"doc_id\": \"off-hours-policy-001\",\n \"content\": \"\u5728\u975e\u5de5\u4f5c\u65f6\u95f4\uff08\u5305\u62ec\u5468\u672b\u548c\u516c\u5171\u5047\u671f\uff09\uff0c\u6211\u65e0\u6cd5\u7acb\u5373\u56de\u590d\u90ae\u4ef6\u3002\"\n },\n {\n \"doc_id\": \"auto-reply-instruction-001\",\n \"content\": \"\u5982\u679c\u90ae\u4ef6\u662f\u5728\u975e\u5de5\u4f5c\u65f6\u95f4\u6536\u5230\u7684\uff0cAI\u52a9\u624b\u5e94\u8be5\u544a\u77e5\u53d1\u4ef6\u4eba\uff0c\u90ae\u4ef6\u5df2\u6536\u5230\uff0c\u6211\u4f1a\u5728\u4e0b\u4e00\u4e2a\u5de5\u4f5c\u65e5\u76849\u70b9\u52305\u70b9\u4e4b\u95f4\u5c3d\u5feb\u5904\u7406\u5e76\u56de\u590d\u3002\"\n }\n\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-240,
-160
],
"id": "75bc8b52-3ff2-43b3-a6fa-d200c821de4a",
"name": "Code in JavaScript1"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "\u8fd9\u662fSimple Vector Store2\u5de5\u5177\uff0c\u7528\u6765\u67e5\u8be2\u6211\u7684\u4e2a\u4eba\u4fe1\u606f\uff0c\u7279\u522b\u662f\u6211\u7684\u5de5\u4f5c\u65f6\u95f4\u548c\u90ae\u4ef6\u56de\u590d\u7b56\u7565\u3002\u5f53\u9700\u8981\u5224\u65ad\u5f53\u524d\u662f\u5426\u4e3a\u5de5\u4f5c\u65f6\u95f4\uff0c\u6216\u8005\u9700\u8981\u544a\u77e5\u5bf9\u65b9\u6211\u4f55\u65f6\u4f1a\u56de\u590d\u90ae\u4ef6\u65f6\uff0c\u5fc5\u987b\u4f7f\u7528\u6b64\u5de5\u5177\u3002",
"memoryKey": {
"__rl": true,
"value": "my-dailytime",
"mode": "list",
"cachedResultName": "my-dailytime"
}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
"typeVersion": 1.3,
"position": [
800,
48
],
"id": "ad9ba7d0-26b7-499b-9c5a-3d4295f6f7ed",
"name": "Simple Vector Store2"
},
{
"parameters": {
"modelName": "models/gemini-embedding-exp-03-07"
},
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"typeVersion": 1,
"position": [
800,
208
],
"id": "9ff48ca5-a7fd-45d6-8ff3-01c86bf63eea",
"name": "Embeddings Google Gemini1",
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"promptType": "define",
"text": "=# \u4e0a\u4e0b\u6587\u4fe1\u606f\n- \u5f53\u524d\u65f6\u95f4: {{ new Date().toLocaleString('en-AU', { timeZone: 'Australia/Sydney', hour12: false }) }} (\u6fb3\u5927\u5229\u4e9a\u6089\u5c3c\u65f6\u95f4)\n- \u53d1\u4ef6\u4eba: {{ $json.From }}\n- \u4e3b\u9898: {{ $json.Subject }}\n- \u90ae\u4ef6\u6b63\u6587: {{ $json.snippet }}",
"hasOutputParser": true,
"options": {
"systemMessage": "=# \u89d2\u8272\u548c\u76ee\u6807\n\u4f60\u662f\u4e00\u4e2a\u5168\u5929\u5019\u5f85\u547d\u3001\u4e13\u4e1a\u9ad8\u6548\u7684AI\u90ae\u4ef6\u52a9\u624b\u3002\u4f60\u7684\u4efb\u52a1\u662f\uff1a\u7b2c\u4e00\u65f6\u95f4\u4f7f\u7528\u516c\u5f00\u4fe1\u606f\u5c3d\u529b\u56de\u7b54\u6240\u6709\u90ae\u4ef6\u4e2d\u7684\u95ee\u9898\uff0c\u5e76\u6839\u636e\u6211\u7684\u5de5\u4f5c\u65e5\u7a0b\uff0c\u5728\u56de\u590d\u7684\u5f00\u5934\u9644\u52a0\u4e0a\u4e0b\u6587\u72b6\u6001\u63d0\u9192\u3002\n\n# \u4e0a\u4e0b\u6587\u4fe1\u606f\n- \u5f53\u524d\u65f6\u95f4: {{ new Date().toLocaleString('en-AU', { timeZone: 'Australia/Sydney', hour12: false }) }} (\u6fb3\u5927\u5229\u4e9a\u6089\u5c3c\u65f6\u95f4)\n- \u90ae\u4ef6\u4fe1\u606f\u5728\u8f93\u5165\u6570\u636e\u4e2d\u3002\n\n# \u53ef\u7528\u5de5\u5177\n- Simple Vector Store2: \u7528\u6765\u67e5\u8be2\u6211\u51c6\u786e\u7684\u5de5\u4f5c\u65f6\u95f4\uff08\u4f8b\u5982\uff1a\u5468\u4e00\u81f3\u5468\u4e94\uff0c\u4e0a\u53489\u70b9\u5230\u4e0b\u53485\u70b9\uff09\u3002\n- SerpAPI: **[\u4e3b\u8981\u4fe1\u606f\u6765\u6e90]** \u4f18\u5148\u4f7f\u7528\u6b64\u5de5\u5177\u5728\u4e92\u8054\u7f51\u4e0a\u641c\u7d22\uff0c\u4ee5\u56de\u7b54\u90ae\u4ef6\u4e2d\u7684\u5177\u4f53\u95ee\u9898\u3002\n\n# \u6267\u884c\u6b65\u9aa4\n1.\u00a0 **\u5206\u6790\u95ee\u9898**: \u9996\u5148\uff0c\u4ed4\u7ec6\u9605\u8bfb\u90ae\u4ef6\u5185\u5bb9\uff0c\u63d0\u70bc\u51fa\u53d1\u4ef6\u4eba\u7684\u6838\u5fc3\u95ee\u9898\u3002\n\n2.\u00a0 **\u5e76\u884c\u4fe1\u606f\u641c\u96c6**: \u540c\u65f6\u6267\u884c\u4ee5\u4e0b\u4e24\u4e2a\u64cd\u4f5c\u6765\u6536\u96c6\u4fe1\u606f\uff1a\n\u00a0 \u00a0 a. \u4f7f\u7528 `SerpAPI` \u5de5\u5177\uff0c\u4e0a\u7f51\u641c\u7d22\u51fa\u53d1\u4ef6\u4eba\u95ee\u9898\u7684\u7b54\u6848\u3002\n\u00a0 \u00a0 b. \u4f7f\u7528 `Simple Vector Store2` \u5de5\u5177\uff0c\u83b7\u53d6\u6211\u8bbe\u5b9a\u7684\u51c6\u786e\u5de5\u4f5c\u65f6\u95f4\u3002\n\n3.\u00a0 **\u8349\u62df\u6838\u5fc3\u56de\u590d**: \u6839\u636e `SerpAPI` \u641c\u96c6\u5230\u7684\u4fe1\u606f\uff0c\u6e05\u6670\u3001\u76f4\u63a5\u5730\u56de\u7b54\u53d1\u4ef6\u4eba\u7684\u95ee\u9898\uff0c\u8fd9\u90e8\u5206\u5c06\u4f5c\u4e3a\u90ae\u4ef6\u56de\u590d\u7684\u4e3b\u4f53\u3002\n\n4.\u00a0 **\u6dfb\u52a0\u72b6\u6001\u524d\u7f00\u5e76\u6574\u5408**:\n\u00a0 \u00a0 a. \u5bf9\u6bd4\u201c\u5f53\u524d\u65f6\u95f4\u201d\u548c\u6211\u4ece\u5de5\u5177\u4e2d\u83b7\u53d6\u7684\u5de5\u4f5c\u65f6\u95f4\u3002\n\u00a0 \u00a0 b. **\u5982\u679c\u5f53\u524d\u662f\u201c\u975e\u5de5\u4f5c\u65f6\u95f4\u201d**: \u521b\u5efa\u4e00\u6bb5\u72b6\u6001\u63d0\u9192\u524d\u7f00\u3002\u8fd9\u6bb5\u524d\u7f00**\u5fc5\u987b\u5305\u542b**\u4ece `Simple Vector Store2` \u83b7\u53d6\u5230\u7684\u5177\u4f53\u5de5\u4f5c\u65f6\u95f4\u3002\n\u00a0 \u00a0 \u00a0 \u00a0 * **\u524d\u7f00\u793a\u4f8b**: \"\u60a8\u597d\uff0c\u611f\u8c22\u60a8\u7684\u6765\u4fe1\u3002\u60a8\u5df2\u5728\u6211\u7684\u975e\u5de5\u4f5c\u65f6\u95f4\u8054\u7cfb\u6211\uff08\u6211\u7684\u5de5\u4f5c\u65f6\u95f4\u4e3a\uff1a[\u6b64\u5904\u63d2\u5165\u67e5\u8be2\u5230\u7684\u5de5\u4f5c\u65f6\u95f4]\uff09\u3002\u6211\u4f1a\u5728\u4e0b\u4e00\u4e2a\u5de5\u4f5c\u65e5\u4eb2\u81ea\u5ba1\u9605\u6b64\u90ae\u4ef6\u3002\u4e0e\u6b64\u540c\u65f6\uff0c\u8fd9\u662f\u6839\u636e\u516c\u5f00\u4fe1\u606f\u4e3a\u60a8\u627e\u5230\u7684\u521d\u6b65\u7b54\u590d\uff1a**<br><br>---<br><br>**\"\n\u00a0 \u00a0 c. **\u5982\u679c\u5f53\u524d\u662f\u201c\u5de5\u4f5c\u65f6\u95f4\u201d**: \u53ea\u9700\u4f7f\u7528\u7b80\u5355\u7684\u95ee\u5019\u8bed\u5373\u53ef\u3002\n\u00a0 \u00a0 \u00a0 \u00a0 * **\u524d\u7f00\u793a\u4f8b**: \"\u60a8\u597d\uff0c\u5173\u4e8e\u60a8\u63d0\u51fa\u7684\u95ee\u9898\uff0c\u7b54\u590d\u5982\u4e0b\uff1a**<br><br>---<br><br>**\"\n\u00a0 \u00a0 d. \u5c06\u751f\u6210\u7684\u524d\u7f00\u548c\u4f60\u8349\u62df\u7684\u6838\u5fc3\u56de\u590d\uff08\u7b2c3\u6b65\u7684\u7ed3\u679c\uff09\u62fc\u63a5\u5728\u4e00\u8d77\uff0c\u5f62\u6210\u6700\u7ec8\u7684\u90ae\u4ef6\u6b63\u6587\u3002\n\n5.\u00a0 **\u683c\u5f0f\u5316\u8f93\u51fa**: \u4f60\u5fc5\u987b\u5c06\u6700\u7ec8\u751f\u6210\u7684\u90ae\u4ef6\u5185\u5bb9\u4ee5\u4e00\u4e2a\u4e25\u683c\u7684 JSON \u683c\u5f0f\u8f93\u51fa\u3002\u683c\u5f0f\u5982\u4e0b\uff0c\u4e0d\u8981\u6dfb\u52a0\u4efb\u4f55\u989d\u5916\u7684\u89e3\u91ca\u6216\u6587\u5b57\uff1a\n\u00a0 \u00a0 {\n\u00a0 \u00a0 \u00a0 \"shouldReply\": true,\n\u00a0 \u00a0 \u00a0 \"subject\": \"Re: [\u539f\u59cb\u90ae\u4ef6\u4e3b\u9898]\",\n\u00a0 \u00a0 \u00a0 \"body\": \"[\u8fd9\u91cc\u662f\u62fc\u63a5\u597d\u7684\u3001\u5b8c\u6574\u7684\u90ae\u4ef6\u56de\u590d\u6b63\u6587\uff0c**\u6240\u6709\u6362\u884c\u5fc5\u987b\u4f7f\u7528HTML\u7684<br>\u6807\u7b7e**]\"\n\u00a0 \u00a0 }\n\n# \u89c4\u5219\u548c\u9650\u5236\n- **\u6c38\u8fdc\u4f18\u5148\u5c1d\u8bd5\u56de\u7b54**: \u65e0\u8bba\u4f55\u65f6\uff0c\u4f60\u7684\u9996\u8981\u4efb\u52a1\u662f\u4f7f\u7528 `SerpAPI` \u4e3a\u7528\u6237\u63d0\u4f9b\u6709\u4ef7\u503c\u7684\u56de\u590d\u3002\n- **\u5fc5\u987b\u58f0\u660e\u72b6\u6001**: \u5982\u679c\u5728\u975e\u5de5\u4f5c\u65f6\u95f4\u56de\u590d\uff0c\u5fc5\u987b\u5728\u90ae\u4ef6\u5f00\u5934\u660e\u786e\u58f0\u660e\uff0c\u5e76\u9644\u4e0a\u6211\u51c6\u786e\u7684\u5de5\u4f5c\u65f6\u95f4\u3002\n- **\u4fe1\u606f\u6765\u6e90\u8981\u51c6\u786e**: \u5de5\u4f5c\u65f6\u95f4\u5fc5\u987b\u4e25\u683c\u4ee5 `Simple Vector Store2` \u7684\u7ed3\u679c\u4e3a\u51c6\uff1b\u95ee\u9898\u7b54\u6848\u4e3b\u8981\u6765\u6e90\u4e8e `SerpAPI`\uff0c\u4e0d\u8981\u7f16\u9020\u4fe1\u606f\u3002\n- **\u8f93\u51fa\u683c\u5f0f**: **\u5728\u6700\u7ec8\u8f93\u51fa\u7684JSON\u4e2d\uff0c`body`\u5b57\u6bb5\u5185\u7684\u6240\u6709\u6362\u884c\u90fd\u5fc5\u987b\u4f7f\u7528 `<br>` \u6807\u7b7e\uff0c\u800c\u4e0d\u662f `\\n`\u3002**"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
576,
-160
],
"id": "b5e90bc0-1d53-4bea-9300-b9982ff5b9b4",
"name": "AI Agent1"
}
],
"connections": {
"Gmail": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent1",
"type": "ai_memory",
"index": 0
}
]
]
},
"SerpAPI": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings Google Gemini": {
"ai_embedding": [
[
{
"node": "Simple Vector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Default Data Loader": {
"ai_document": [
[
{
"node": "Simple Vector Store1",
"type": "ai_document",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Simple Vector Store1",
"type": "main",
"index": 0
}
]
]
},
"Simple Vector Store2": {
"ai_tool": [
[
{
"node": "AI Agent1",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings Google Gemini1": {
"ai_embedding": [
[
{
"node": "Simple Vector Store2",
"type": "ai_embedding",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "4b54e880-ce89-48af-bc22-d753d162b460",
"id": "b8xRsyXsQr5XE16V",
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googlePalmApiserpApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
HelloAgent_n8nCase. Uses gmailTrigger, lmChatGoogleGemini, memoryBufferWindow, toolSerpApi. Event-driven trigger; 12 nodes.
Source: https://github.com/datawhalechina/hello-agents/blob/1a3b2877d5a926f24aaaea0e279b1565b5d28017/code/chapter5/HelloAgent_n8nCase.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.
This template is a complete, hands-on tutorial for building a RAG (Retrieval-Augmented Generation) pipeline. In simple terms, you'll teach an AI to become an expert on a specific topic—in this case, t
My workflow 2. Uses googleGemini, formTrigger, httpRequest, googleDrive. Event-driven trigger; 33 nodes.
Geminis. Uses toolSerpApi, googleGemini, chatTrigger, agent. Event-driven trigger; 22 nodes.
Advanced Gmail AI Auto-Responder with Context Intelligence The next-generation email automation that knows your communication style, remembers conversations, and responds with human-like intelligence.