from langchain_core.messages import SystemMessage
def chat_llm_node(state: MessagesState):
history = [
SystemMessage(content="You are a customer support assistant.")
]
history.extend(state["messages"])
reply = llm.invoke(history)
return {"messages": [reply]}sees full conversation history
append the reply to history