So you've built an agentic AI system with LangGraph and MCP, and it's working great - until it starts forgetting what the user said two turns ago. You're trying to implement a simple support bot that can answer follow-up questions, but it keeps responding as if it has no memory. You've checked the LangGraph documentation, and it seems like the StateGraph should be able to handle this kind of context. But for some reason, it's just not working.
Let's take a step back and look at how LangGraph's ReAct loop is supposed to work. The idea is that your agent will reason about the current state of the world, act based on that reasoning, observe the consequences of its action, and then repeat the process. This loop is the core of how LangGraph agents make decisions and learn from their environment.
In your support bot, the ReAct loop might look something like this:
import langgraph as lg
# Create a new StateGraph







