-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue Description
Currently, the agent implementation in agent.py does not maintain conversation history between user inputs. Each time a user enters a new query, only that single message is sent to the LLM without any context from previous exchanges.
Why This Matters
This limitation prevents the agent from:
- Referencing previous user questions or its own answers
- Building contextual understanding over a conversation
- Following the prompt instruction to "answer from conversation history"
Proposed Solution
Implement conversation history persistence by:
- Creating a
conversation_historylist at the start of the main loop - Appending each user message to this history
- Passing the full history to the agent on each invocation
- Saving the assistant's responses back to the history
# Retain full chat history across turns
conversation_history: list[BaseMessage] = []
while True:
user_input = input("\nYou: ")
if user_input.lower() in ["quit", "exit"]:
break
conversation_history.append(HumanMessage(content=user_input))
inputs = {"messages": conversation_history}
# ... existing code ...
# Save assistant reply to history to preserve context
conversation_history.append(final_answer)References
- Originally discussed in PR #1 comment
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels