โ AI Agents/M-041Add Conversation Memory to the Support Agent๐ Guide๐
Rank 07ยท The Strategist
๐Debugging Missionยทintermediateยทโฑ๏ธ 30โ45mยทโญ 175 XP
M-041Add Conversation Memory to the Support Agent
Description
Nebula Corp's support agent answers questions correctly but forgets everything between turns. A user asks 'What plan is Alice on?' and gets the right answer, but when they follow up with 'How much does that plan cost?' the agent has no idea what 'that plan' refers to. Implement a conversation memory system that stores past exchanges so the agent can resolve references and maintain context across turns.
Symptoms
wrong-outputThe agent answers the first question correctly but cannot resolve references in follow-up questions
missing-logicEach call to chat() starts with a fresh message array containing only the system prompt and current user message
Expected Behavior (2)
Resolves pronoun reference across turns
Second turn should resolve 'that plan' to Pro using conversation history
Input:(() => { const a = new SupportAgent(); a.chat('What plan is customer C001 on?'); return a.chat('How much does that plan cost?'); })()
Expected:CONTAINS:49
Maintains context over multiple turns
Agent should maintain context across three consecutive turns
Input:(() => { const a = new SupportAgent(); a.chat('Look up C001'); a.chat('What plan?'); return a.chat('Price?'); })()
Expected:CONTAINS:FINAL
Related Lessons
Click Run / Check to validate your solution