DEV Community

Cover image for Agents & LLMs do NOT have Temporal Awareness

Agents & LLMs do NOT have Temporal Awareness

When building AI-powered automation workflows in n8n that require current date information, e.g. fetching today's stock prices I noticed my AI agent sends wildly outdated dates.

This happened when I asked it to "get the latest stock price" and it used a dates like 2023-10-02, even though today is 2026. They don't have a built-in calendar.


Do NOT worry tho, we have a solution in n8n. You can use the builtin Luxon date object: https://docs.n8n.io/build/work-with-data/transform-data/expression-reference/datetime

n8n date


Another place you might see this is when prompting, in that case you need to add a new tool to your workflow so AI Agent can get the current date:

{
  "name": "My workflow",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        0,
        0
      ],
      "id": "3b16cd7d-f22a-48fa-99f6-c4f1b81d20ba",
      "name": "When chat message received",
      "webhookId": "82032bcd-f9b6-4e41-8886-84d5779b0ea6",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        208,
        0
      ],
      "id": "50ef3ba1-1451-47a9-9247-d6be00512fcd",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        208,
        192
      ],
      "id": "93fbdbf3-5599-4d72-b460-4976fa8890db",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "0h4kMjpTValhfJZv",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.dateTimeTool",
      "typeVersion": 2,
      "position": [
        448,
        176
      ],
      "id": "1c42f19c-5ab3-454c-be4b-e9b744b2f9f6",
      "name": "Date & Time"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "2e6145a8-06a8-469c-ba80-719563f146ac",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "d7f40ac67c918c6b77c1db2f31baa37e504a493b4a22e372f2a513b7bf0ca5a9"
  },
  "nodeGroups": [],
  "id": "6bsOs8ssUv4uxhna",
  "tags": []
}
Enter fullscreen mode Exit fullscreen mode

Then when we ask "what is the current date?" it will return the correct date!

Top comments (0)