A message list keeps a conversation’s turns in chronological order. In a conversational agent, it provides short-term context without a separate memory class: LangChain models accept a list of `HumanMessage` and `AIMessage` objects directly. section 6.2.2 section 6.5
from langchain_core.messages import HumanMessage, AIMessage
chat_history = []
chat_history.append(HumanMessage(content="What's the weather in Paris?"))
chat_history.append(AIMessage(content="It's sunny and 25°C."))
# Inspect the history
for msg in chat_history:
role = "Human" if isinstance(msg, HumanMessage) else "AI"
print(f"{role}: {msg.content}")
The Python listing appends a human turn and an AI reply, then prints the stored history. It demonstrates storage and inspection, not a model call. section 6.2.2
Keeping every turn verbatim makes earlier exchanges available, but the list grows with the conversation. Use full-history retention for short or limited-scope interactions. For longer conversations or tighter context limits, an LLM-generated running summary can condense less-relevant details while preserving core context. Persistent memory serves a different need: retaining information across sessions. section 6.2.2 section 6.5
