Skip to content
AI Support Agent

Module 08 · ai · intermediate

starter.json

In n8n, copy this file and paste it onto the canvas, or use Import from File.

{
  "name": "08 - AI Support Agent (starter)",
  "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": {
        "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": {
        "content": "## Your task\n1. Add an **AI Agent** after the Chat Trigger, with an **OpenAI Chat Model** (gpt-5-mini) and **Simple Memory** (10 messages).\n2. Write a system message with the store policies and rules (when to use which tool, max 80 words, stay on topic).\n3. Connect **lookup_order** as a tool. Add a second Code tool **create_support_ticket** that returns a ticket ID.\n4. Publish and open the chat URL from the Chat Trigger.\n\nTest: `WITH_CREDS=1 ./test/test.sh`",
        "height": 260,
        "width": 420
      },
      "id": "starter-task-note",
      "name": "Your Task",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -340
      ]
    }
  ],
  "connections": {
    "Support Chat": {
      "main": [
        []
      ]
    },
    "lookup_order": {
      "ai_tool": [
        []
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  }
}