{
  "name": "Support agent",
  "nodes": [
    {
      "id": "6aa92673-9a43-4b9c-80b2-9bdd4d8f2199",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {}
      }
    },
    {
      "id": "587a6684-46d7-4e19-8166-ee95bd133b1b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        260,
        0
      ],
      "parameters": {
        "promptType": "auto",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "You are the support assistant for an online shop. Use the get_order_status tool to look up orders; never guess an order's status. Use the calculator for any arithmetic. Keep answers to two sentences."
        }
      }
    },
    {
      "id": "f06c72cf-8268-46e0-b662-00512d7b9df8",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        160,
        220
      ],
      "parameters": {
        "model": "qwen2.5:3b",
        "options": {
          "temperature": 0,
          "think": false
        }
      },
      "credentials": {
        "ollamaApi": {
          "name": "Ollama local"
        }
      }
    },
    {
      "id": "1ccf0b1b-c9c9-4847-b84d-e405080615d9",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        300,
        220
      ],
      "parameters": {
        "contextWindowLength": 5
      }
    },
    {
      "id": "d47ada06-8bbb-400a-91db-ed826493ca70",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        440,
        220
      ],
      "parameters": {}
    },
    {
      "id": "c2476a99-8088-4e04-8d05-adceba643859",
      "name": "get_order_status",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "position": [
        580,
        220
      ],
      "parameters": {
        "description": "Look up the status, carrier and delivery date of an order by its order number.",
        "source": "database",
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "orderId": "={{ $fromAI('orderId', 'The order number, for example 1042', 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "orderId",
              "displayName": "orderId",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_order_status": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
