Skip to content

Instantly share code, notes, and snippets.

@llermaly
Created October 4, 2025 14:53
Show Gist options
  • Select an option

  • Save llermaly/feb8ab33e15144f05660b183cbd8d24f to your computer and use it in GitHub Desktop.

Select an option

Save llermaly/feb8ab33e15144f05660b183cbd8d24f to your computer and use it in GitHub Desktop.
Agent builder + N8N Workflow
{
"name": "My workflow",
"nodes": [
{
"parameters": {
"promptType": "define",
"text": "=You are a helpful assistant that helps analyzing Google \"Peoople Ask About\" related questions for specific keywords for a given week.\n\nThe results for the keyword: {{ $json.search_parameters.q }} are:\n\n{{ $json.related_questions.toJsonString() }}\n\nI want you to use your search tool to go find historical searches using the following ESQL query:\n\n`FROM serp_results` Run this query as is.\n\nAnd then write a report analysis using the Google docs tool.\n\nYou must first create the doc, and pass the document id to the add content tool. Use the keyword and the date for the document title.\nFor the report I'm looking for the format:\n\n# Todays date, keyword\n# This week results summary\n# Total dataset results summary\n# Conclusion about differences between the current week, and the total dataset changes\n",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
56,
24
],
"id": "6c39a126-0d43-4bfe-9365-2af9b7014230",
"name": "AI Agent"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
-64,
248
],
"id": "ad9a4bd2-d6ab-44b1-bbc2-0e0d929782ed",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "SMFFqf3dQMaD4feA",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"endpointUrl": "https://o-d4c46f.kb.us-central1.gcp.elastic.cloud/api/agent_builder/mcp",
"serverTransport": "httpStreamable",
"authentication": "headerAuth",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"typeVersion": 1.1,
"position": [
64,
248
],
"id": "526a1140-1ac8-4d6a-9db0-dc20659f4459",
"name": "Elasticsearch MCP",
"credentials": {
"httpHeaderAuth": {
"id": "C0NbyjhqmQUOW2Mn",
"name": "Header Auth account"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-512,
-124
],
"id": "013db842-7028-4fd8-82ae-70e0f5467b4e",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"q": "elasticsearch",
"additionalFields": {},
"requestOptions": {}
},
"type": "n8n-nodes-serpapi.serpApi",
"typeVersion": 1,
"position": [
-288,
-124
],
"id": "c961346a-8b86-4184-a4cf-2413c0110a1d",
"name": "Google search",
"credentials": {
"serpApi": {
"id": "DzrsnHrXfqjoaE8J",
"name": "SerpApi account"
}
}
},
{
"parameters": {
"fieldToSplitOut": "related_questions",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
120,
-272
],
"id": "40cd8cab-9f93-4f33-9cd6-5f646526bf37",
"name": "Split Out"
},
{
"parameters": {
"method": "POST",
"url": "https://o-d4c46f.es.us-central1.gcp.elastic.cloud:443/serp_results/_doc",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ $json.toJsonString() }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
528,
-272
],
"id": "d133bd37-2b5e-4ab3-935c-65344fcb7ce0",
"name": "HTTP Request",
"credentials": {
"httpHeaderAuth": {
"id": "C0NbyjhqmQUOW2Mn",
"name": "Header Auth account"
}
}
},
{
"parameters": {
"folderId": "default",
"title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}"
},
"type": "n8n-nodes-base.googleDocsTool",
"typeVersion": 2,
"position": [
192,
248
],
"id": "6e71c437-9d1a-439f-b50e-3284841303a6",
"name": "Create a document in Google Docs",
"credentials": {
"googleDocsOAuth2Api": {
"id": "HNd4NwZn39UDHHBs",
"name": "Google Docs account"
}
}
},
{
"parameters": {
"operation": "update",
"documentURL": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doc_ID_or_URL', ``, 'string') }}",
"actionsUi": {
"actionFields": [
{
"action": "insert",
"text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('actionFields0_Text', ``, 'string') }}"
}
]
}
},
"type": "n8n-nodes-base.googleDocsTool",
"typeVersion": 2,
"position": [
320,
248
],
"id": "6d455375-06cc-4e9e-acc1-f3b9ff98b7da",
"name": "Update a document in Google Docs",
"credentials": {
"googleDocsOAuth2Api": {
"id": "HNd4NwZn39UDHHBs",
"name": "Google Docs account"
}
}
}
],
"pinData": {},
"connections": {
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Elasticsearch MCP": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Google search",
"type": "main",
"index": 0
}
]
]
},
"Google search": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
},
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[]
]
},
"Split Out": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Create a document in Google Docs": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Update a document in Google Docs": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "0389eb17-3c9b-4810-8fbd-28f44e11b54b",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "70e5e0b36049fd0d8c6446a70ac33d8ef4cd67c1e9a65dd65058083caa82661b"
},
"id": "lTRQA1MEGFKwHMXc",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment