AI Support Agent
Module 08 · ai · intermediate
learner.json
In n8n, copy this file and paste it onto the canvas, or use Import from File.
{
"name": "08 - AI Support Agent",
"nodes": [
{
"parameters": {
"public": true,
"mode": "hostedChat",
"initialMessages": "Hi! 👋 I'm the Brewlab support assistant. I can check your order status, answer questions about shipping and returns, or open a ticket for our team.",
"options": {
"title": "Brewlab Support",
"subtitle": "Usually answers instantly",
"inputPlaceholder": "Ask about your order…",
"showWelcomeScreen": false
}
},
"id": "m08-chat",
"name": "Support Chat",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.4,
"position": [0, 0],
"webhookId": "course-08-support-chat"
},
{
"parameters": {
"options": {
"systemMessage": "=You are the friendly support assistant for Brewlab Coffee Co., an online shop selling coffee beans and brewing gear.\n\nToday is {{ $now.toFormat('yyyy-MM-dd') }}.\n\nSTORE POLICIES (the only facts you may state about the store):\n- Shipping: orders ship within 1 business day. US delivery takes 2–5 business days; international 7–14.\n- Free US shipping on orders over $40.\n- Returns: unopened items within 30 days for a full refund. Opened coffee cannot be returned, but if it arrived damaged or stale we replace it free.\n- Order IDs look like A1001.\n- Support hours for humans: Mon–Fri, 9am–5pm CT.\n\nRULES:\n- Use the lookup_order tool whenever the customer gives an order ID or asks about an order. Never guess order details.\n- If you cannot solve the problem, or the customer asks for a human, or something was damaged, use create_support_ticket and give them the ticket ID.\n- Ask for the order ID or email if you need it.\n- Keep answers under 80 words. Be warm and concrete.\n- If a question is unrelated to Brewlab, politely say you can only help with Brewlab orders.",
"maxIterations": 6
}
},
"id": "m08-agent",
"name": "Support Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [260, 0]
},
{
"parameters": {
"model": { "__rl": true, "mode": "list", "value": "gpt-5-mini", "cachedResultName": "gpt-5-mini" },
"options": {}
},
"id": "m08-model",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [120, 240]
},
{
"parameters": { "contextWindowLength": 10 },
"id": "m08-memory",
"name": "Conversation Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [280, 240]
},
{
"parameters": {
"description": "Look up an order by its ID (format A1234). Returns status, items, carrier, tracking number and estimated delivery. Use whenever the customer mentions an order.",
"jsCode": "// Demo order database. In the Business version this is a Google Sheets / Shopify lookup.\nconst orders = {\n A1001: { status: 'shipped', items: ['Ethiopia Yirgacheffe 250g', 'Paper filters'], carrier: 'UPS', tracking: '1Z999AA10123456784', estimated_delivery: '2026-10-17', email: 'maria@example.com' },\n A1002: { status: 'processing', items: ['Hario V60 dripper'], carrier: null, tracking: null, estimated_delivery: '2026-10-21', email: 'sam@example.com' },\n A1003: { status: 'delivered', items: ['Colombia Huila 1kg'], carrier: 'USPS', tracking: '9400111899223856', estimated_delivery: '2026-10-09', email: 'lee@example.com' },\n};\nconst id = String(query.order_id ?? '').trim().toUpperCase();\nconst order = orders[id];\nif (!order) return JSON.stringify({ found: false, order_id: id, message: 'No order with this ID. Ask the customer to double-check it.' });\nreturn JSON.stringify({ found: true, order_id: id, ...order });",
"specifyInputSchema": true,
"schemaType": "fromJson",
"jsonSchemaExample": "{\n \"order_id\": \"A1001\"\n}"
},
"id": "m08-tool-order",
"name": "lookup_order",
"type": "@n8n/n8n-nodes-langchain.toolCode",
"typeVersion": 1.3,
"position": [440, 240]
},
{
"parameters": {
"description": "Create a ticket for the human support team. Use when you cannot resolve the issue, an item arrived damaged, or the customer asks for a human. Returns the ticket ID to share with the customer.",
"jsCode": "// Demo ticketing. In the Business version this appends to a Google Sheet / helpdesk and alerts the team.\nconst ticketId = 'T-' + Math.floor(10000 + Math.random() * 90000);\nreturn JSON.stringify({ ticket_id: ticketId, summary: query.summary, priority: query.priority ?? 'normal', reply_within: '1 business day' });",
"specifyInputSchema": true,
"schemaType": "fromJson",
"jsonSchemaExample": "{\n \"summary\": \"Order A1003 arrived with a torn bag\",\n \"customer_contact\": \"lee@example.com\",\n \"priority\": \"normal\"\n}"
},
"id": "m08-tool-ticket",
"name": "create_support_ticket",
"type": "@n8n/n8n-nodes-langchain.toolCode",
"typeVersion": 1.3,
"position": [600, 240]
}
],
"connections": {
"Support Chat": { "main": [[{ "node": "Support Agent", "type": "main", "index": 0 }]] },
"OpenAI Chat Model": { "ai_languageModel": [[{ "node": "Support Agent", "type": "ai_languageModel", "index": 0 }]] },
"Conversation Memory": { "ai_memory": [[{ "node": "Support Agent", "type": "ai_memory", "index": 0 }]] },
"lookup_order": { "ai_tool": [[{ "node": "Support Agent", "type": "ai_tool", "index": 0 }]] },
"create_support_ticket": { "ai_tool": [[{ "node": "Support Agent", "type": "ai_tool", "index": 0 }]] }
},
"pinData": {},
"settings": { "executionOrder": "v1" }
}