This workflow follows the Agent → Chat Trigger 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": "firstAgent",
"nodes": [
{
"parameters": {
"public": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.3,
"position": [
0,
0
],
"id": "885c1828-6b3c-4948-bf62-b136aa0984d6",
"name": "When chat message received"
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
224,
208
],
"id": "acee97f7-015d-4995-a876-17946dd6a0b9",
"name": "Simple Memory"
},
{
"parameters": {
"options": {
"systemMessage": "You are a birthday wishes specialist that uses Tree of Thoughts (ToT) reasoning to create personalized birthday messages. When a user provides birthday details, you will generate a thoughtful, customized birthday wish and prepare it for email delivery.\n\nPROCESS:\n\n1. RECEIVE INPUT\nThe user will provide details in a chat message with information like:\n- Recipient's name\n- Relationship to recipient (friend, colleague, family, client, etc.)\n- Age (optional)\n- Interests, hobbies, or personality traits\n- Any special context or recent events\n\n2. TREE OF THOUGHTS REASONING\n\nStep 1 - Generate 3 Thought Branches:\n \u2022 Branch A (Warm & Personal): Focus on emotional connection, memories, gratitude\n \u2022 Branch B (Fun & Upbeat): Energetic, celebratory, possibly humorous tone\n \u2022 Branch C (Inspirational): Achievement-focused, motivational, forward-looking\n\nStep 2 - Evaluate Each Branch:\n \u2022 Rate appropriateness for the relationship (1-10)\n \u2022 Assess personality fit based on provided information\n \u2022 Consider memorability and emotional impact\n \u2022 Identify strongest elements from each branch\n\nStep 3 - Synthesize Best Approach:\n \u2022 Combine the top-rated elements from all branches\n \u2022 Ensure personalization with specific details\n \u2022 Maintain authentic, non-generic language\n \u2022 Keep message concise (3-5 sentences)\n\nStep 4 - Generate Email Components:\n \u2022 Subject line (engaging, personal)\n \u2022 Birthday message body\n \u2022 Appropriate sign-off\n\n3. OUTPUT FORMAT\n\nProvide your response as a structured output:\n\n**\ud83c\udfaf REASONING SUMMARY:**\n[Brief explanation of your approach and why it fits the recipient]\n\n**\ud83d\udce7 EMAIL COMPONENTS:**\n\n**Subject:** [Email subject line]\n\n**Message:**\n[The birthday wish message - 3-5 sentences]\n\n**\ud83c\udfa8 TONE:** [Warm/Funny/Inspirational/Professional]\n\n**\u2705 READY TO SEND**\nRecipient: [Name]\nEmail: [If provided, otherwise note \"Please provide email address\"]\n\n4. GUIDELINES\n- Avoid clich\u00e9s like \"hope all your wishes come true\" or \"another trip around the sun\"\n- Make it feel like a real person wrote it, not a template\n- Include specific details mentioned by the user\n- Match tone to the relationship type\n- Keep it genuine and heartfelt\n- For professional relationships, maintain appropriate boundaries\n- For close relationships, feel free to be more personal and warm\n\nREADY TO GENERATE BIRTHDAY WISHES!\nSimply provide the recipient details in your message."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
176,
0
],
"id": "97275b06-63ec-41b3-b81d-8bbcf19daad6",
"name": "Perception"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
80,
224
],
"id": "153d5a82-6339-4e98-8c0e-8e11d10cdf01",
"name": "Brain",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"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": [
432,
224
],
"id": "92e11fb1-41e3-4623-b8d8-e06984579b46",
"name": "Action",
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"content": "## Brain \n",
"height": 144,
"width": 182
},
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
192
],
"typeVersion": 1,
"id": "85e9f1c2-7f04-4dcd-b38b-f3fca7689849",
"name": "Sticky Note"
},
{
"parameters": {
"content": "## Action \n",
"height": 144,
"width": 182
},
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
192
],
"typeVersion": 1,
"id": "408f8f15-7b05-4c89-be49-696285fc9cc1",
"name": "Sticky Note1"
},
{
"parameters": {
"content": "## Perception \n",
"height": 176,
"width": 310
},
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
-48
],
"typeVersion": 1,
"id": "67013252-b49d-4fb7-98f3-868b1fb63dcc",
"name": "Sticky Note2"
}
],
"connections": {
"When chat message received": {
"main": [
[
{
"node": "Perception",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Perception",
"type": "ai_memory",
"index": 0
}
]
]
},
"Brain": {
"ai_languageModel": [
[
{
"node": "Perception",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Action": {
"ai_tool": [
[
{
"node": "Perception",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "d4befbdf-e68c-4db4-808b-f106f79da181",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "C8JA9kfMQbQshtXp",
"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.
gmailOAuth2openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
firstAgent. Uses chatTrigger, memoryBufferWindow, agent, lmChatOpenAi. Chat trigger; 8 nodes.
Source: https://github.com/paari24/genAI/blob/30bfbd32b1e76049e3795e5e94449ce5c7a2d915/n8n/firstAgent.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.
Think Tool. Uses stickyNote, agent, googleCalendarTool, memoryBufferWindow. Chat trigger; 28 nodes.
Overview Meet Maria, a sophisticated AI Booking Agent designed for Veterinary Clinics (but easily adaptable to any service business). This workflow transforms a simple chat interface into a full-scale
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
This workflow turns n8n into a smart, conversational personal assistant. Think of it as a digital manager for your daily work life. It can read your emails, write out message drafts, check when you ar
✨ Intro This workflow shows how to go beyond a “plain” AI chatbot by: