Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

n8n AI Agent Session ID Memory, Explained: Why Your Agent Forgets Everything Between Runs

说明与用途

在 n8n 中,AI 代理因使用执行 ID 作为会话键而在运行之间忘记上下文。设置一个稳定的键(例如每个工作流的固定字符串或用户 ID)即可保留历史记录并提升代理性能。

问题

Scheduled n8n AI agents lose memory between runs because the memory node uses a unique execution ID as the session key, causing each run to start with an empty conversation history.

结果

Agents retain context across scheduled runs, reducing repetitive behavior and improving user experience.

工作流

  • 1. Identify the memory node type used in the workflow.
  • 2. Determine the desired memory pattern (per-user, per-workflow, or per-execution).
  • 3. Set the session key accordingly: user ID for chat agents, a fixed string for scheduled agents, or execution ID for stateless runs.
  • 4. If durability is required, switch to Postgres or Redis memory nodes.
  • 5. For multi-tool agents, integrate a shared memory layer such as Vilix AI via MCP.
  • 6. Test the workflow to confirm history persists across runs.

证据

The execution ID is unique per run. That is its entire job. So when the memory node keys on it, Monday's 6am run writes its history under Monday's execution ID, and Tuesday's 6am run asks for Tuesday's execution ID, finds nothing, and starts from zero.

来源

Pick your pattern: 1. Per-user memory, 2. Per-workflow memory, 3. Per-execution isolation.

来源

  • 记录日期: 2026-09-22T17:15:46.814Z