n8n AI Agent Session ID Memory, Explained: Why Your Agent Forgets Everything Between Runs
Описание и применение
В n8n агенты AI забывают контекст между запусками из‑за использования уникального 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