[GH-ISSUE #449] Bug: Variable name conflict in Streamlit chat loop overwrites Memory object in ai travel agent with memory #6456

Closed
opened 2026-05-31 13:47:11 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @Veeksha-c on GitHub (Jan 31, 2026).
Original GitHub issue: https://github.com/Shubhamsaboo/awesome-llm-apps/issues/449

In the provided Streamlit example for the AI Travel Agent, the loop variable used to display memories uses the same name as the initialized Memory object from the mem0 library. This causes a NameError or AttributeError when the script later tries to call memory.add(), as the original object has been overwritten by a dictionary/string from the loop.

The 'memory' variable here overwrites the 'memory = Memory.from_config(config)' object

for memory in relevant_memories["results"]:
if "memory" in memory:
context += f"- {memory['memory']}\n"

Suggested Fix
Rename the loop variable to mem or result to preserve the global memory object:

Python
for mem in relevant_memories["results"]:
if "memory" in mem:
context += f"- {mem['memory']}\n"

Additional Context
I am a student currently learning about Agentic AI and found this while testing the implementation locally with Docker. Thank you for maintaining this repository!

Originally created by @Veeksha-c on GitHub (Jan 31, 2026). Original GitHub issue: https://github.com/Shubhamsaboo/awesome-llm-apps/issues/449 In the provided Streamlit example for the AI Travel Agent, the loop variable used to display memories uses the same name as the initialized Memory object from the mem0 library. This causes a NameError or AttributeError when the script later tries to call memory.add(), as the original object has been overwritten by a dictionary/string from the loop. # The 'memory' variable here overwrites the 'memory = Memory.from_config(config)' object for memory in relevant_memories["results"]: if "memory" in memory: context += f"- {memory['memory']}\n" Suggested Fix Rename the loop variable to mem or result to preserve the global memory object: Python for mem in relevant_memories["results"]: if "memory" in mem: context += f"- {mem['memory']}\n" Additional Context I am a student currently learning about Agentic AI and found this while testing the implementation locally with Docker. Thank you for maintaining this repository!
Author
Owner

@Shubhamsaboo commented on GitHub (Feb 1, 2026):

Thank you for pointing it out. Just got it fixed.

<!-- gh-comment-id:3830343141 --> @Shubhamsaboo commented on GitHub (Feb 1, 2026): Thank you for pointing it out. Just got it fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-llm-apps#6456