Hi everyone!
I’m facing a problem with an AI agent flow for WhatsApp on n8n, using Redis along with Redis as the agent’s memory.
What the flow needs to do:
The expected behavior is:
The AI agent responds normally while only the customer is chatting.
When a human (attendant) joins the conversation, the agent should completely stop responding.
After a period of inactivity from the human, the agent should automatically resume responding if the customer sends new messages.
How I implemented it:
I’m using Redis to identify:
Customer messages
Human/attendant messages
I used IFs and conditionals to interrupt or allow the AI flow.
I followed the flow exactly as shown in this video:
[video link]
The agent’s memory is Redis.
The problem:
The flow works correctly while only the customer is chatting with the bot.
The moment a human joins the conversation, the flow breaks.
The n8n agent is now returning the error:
Cannot read properties of undefined (reading ‘map’)
The error seems to be related to the AI Memory/History node (Redis).
This only happens when the Redis nodes are active.
If I remove Redis, the agent works normally again.
Observations: The error occurs exactly when a human sends a message.
Apparently, at this point the Memory in Redis is in an invalid or unexpected state (e.g., empty history or different structure).
The interruption logic works, but the combined use of Redis + Redis Memory causes the flow to break.
Questions: Has anyone else experienced this problem using Redis + Redis Memory + AI Agent in n8n?
Is it necessary to clear/reset the memory in Redis when a human joins the conversation?
Is there a correct way to pause the agent without affecting the memory?
Could this error be related to human messages being written to Redis without valid content? Any help or guidance will be greatly appreciated ![]()