Consider taking the output from the AI Agent node and creating a text file using the Google Drive node rather than the tool, best of luck.
{
“nodes”: [
{
“parameters”: {
“options”: {}
},
“type”: “ @n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.4,
“position”: [
-16,
128
],
“id”: “dde7dbf8-ed44-4843-9d2c-788361df4705”,
“name”: “When chat message received”,
“webhookId”: “a5d3ef66-1eb5-4376-a8e1-ff4b952bbd6c”
},
{
“parameters”: {
“options”: {
“systemMessage”: “SYSTEM PROMPT: DAILY OPERATIONAL BRIEFING AGENT\n\nYou are a Daily Operational Reporting Agent for a national security and border management organization.\n\nYour task is to generate a formal Daily Brief / Daily Operational Report in the exact professional style and structure of official GIS intelligence and situation reports.\n\nCore Responsibilities\n\nReport Creation\n\nProduce a structured Daily Brief similar in format, tone, and layout to official security service reports.\n\nUse numbered sectioning and sub-sectioning exactly in the style below:\n\n1.1 LOCATION / COMMAND\n\n1.1.1 INCIDENT TITLE\n\nEach incident must be presented in bullet-point narrative form, beginning with date, time, subject, action, and outcome.\n\nFormatting Style (Mandatory)\n\nFollow this structure strictly:\n\nNumbered headings (e.g., 1.1, 1.1.1, 1.2, 1.2.1, etc.)\n\nUppercase section titles\n\nProfessional intelligence language\n\nChronological, factual, neutral tone\n\nNo storytelling, no emotions, no opinions\n\nExample style:\n\n1.1 KOTOKA INTERNATIONAL AIRPORT (KIA)\n1.1.1 INDIAN NATIONAL REFUSED ENTRY AT KIA\n\n• On 12/03/2025, at about 0928hrs, …\n• Subject was …\n• Action taken …\n\n\nDocument Generation\n\nCompile the full report into a properly formatted DOCX file.\n\nThe document must contain:\n\nOfficial header (Service name, address, reference, date)\n\nReport title (e.g., DAILY OPERATIONAL REPORT)\n\nPart One: Border Management\n\nPart Two: Other Security Issues (when applicable)\n\nClosing endorsement line (e.g., “Respectfully submitted, Sir.”)\n\nSignature block (Comptroller-General or equivalent)\n\nEmail Delivery\n\nOnce the DOCX file is generated, use the tool “Email Tool” to send the report as an attachment.\n\nThe email must be formal and addressed to senior management.\n\nSubject line: “DAILY OPERATIONAL REPORT – [DATE]”\n\nLanguage & Tone\n\nFormal\n\nOperational\n\nIntelligence-reporting style\n\nNo casual language\n\nNo summaries outside the report body\n\nAccuracy & Consistency\n\nAll times in 24-hour format (e.g., 0928hrs)\n\nAll dates in DD/MM/YYYY\n\nUse standard security terminology: “subject”, “escort”, “removed”, “intercepted”, “refused entry”, “granted passage”, “under review”, etc.\n\nYour final output must always be:\n\nA fully formatted DOCX Daily Brief in the official style.\n\nAutomatically sent via the Email Tool as an attachment.”
}
},
“type”: “ @n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 3.1,
“position”: [
272,
128
],
“id”: “3f7ae08e-dd6c-4be3-9798-01bf2b133dee”,
“name”: “AI Agent”
},
{
“parameters”: {
“fromEmail”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘From_Email’, , 'string') }}", "toEmail": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To_Email', , ‘string’) }}”,
“subject”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Subject’, , 'string') }}", "emailFormat": "text", "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', , ‘string’) }}”,
“options”: {
“attachments”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘Attachments’, , 'string') }}" } }, "type": "n8n-nodes-base.emailSendTool", "typeVersion": 2.1, "position": [ 464, 352 ], "id": "a6a32170-79be-4dcf-b648-167e17b8a6fd", "name": "Send email in Send Email", "webhookId": "a724a0c1-2d52-47cf-8760-b2bbd090b3d7" }, { "parameters": { "model": { "__rl": true, "value": "gpt-4.1-mini", "mode": "list", "cachedResultName": "gpt-4.1-mini" }, "builtInTools": {}, "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.3, "position": [ 144, 336 ], "id": "31b2a64c-d76c-47aa-80c4-b2d2c18f609a", "name": "OpenAI Chat Model" }, { "parameters": { "folderId": "1FtvQz5Vd5Ujkvpuy6AmACDvbRTMRSogx", "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', , ‘string’) }}”
},
“type”: “n8n-nodes-base.googleDocsTool”,
“typeVersion”: 2,
“position”: [
576,
352
],
“id”: “1153da10-ea93-4c1a-8ef8-005a3178c7b4”,
“name”: “Create a document in Google Docs”
},
{
“parameters”: {
“operation”: “createFromText”,
“driveId”: {
“__rl”: true,
“mode”: “list”,
“value”: “My Drive”
},
“folderId”: {
“__rl”: true,
“mode”: “list”,
“value”: “root”,
“cachedResultName”: “/ (Root folder)”
},
“options”: {}
},
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 3,
“position”: [
752,
128
],
“id”: “07f2dbc5-0cc2-4295-a074-12bbf50dd950”,
“name”: “Create file from text”,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “HoC5sXJwjQTwuoQm”,
“name”: “Google Drive account”
}
}
}
],
“connections”: {
“When chat message received”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Create file from text”,
“type”: “main”,
“index”: 0
}
]
]
},
“Send email in Send Email”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“OpenAI Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Create a document in Google Docs”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “fd1f4c77f976ad5400364899abdbfcc08cd8c647bc44f9cd5012a41a7693a822”
}
}