LangGraph is a graph framework where you declare typed state, named nodes (functions), and directed edges (conditional or fixed). The graph can cycle, branch, and pause for human input. Linear chains (LCEL pipe) can’t represent loops, persistent memory, or routing — those need a graph.
StateGraph(State) with messages: Annotated[list, operator.add] accumulates chat turns across nodes.
add_conditional_edges(“model”, decide, {”loop”: “model”, END: END}) lets the LLM decide to keep going.
compile(checkpointer=memory) persists state by thread_id so the run survives a crash.
START -> call_model -> should_continue? -> yes -> call_tool -> call_model
-> no -> END
If your task needs loops, branching, or pause/resume, use LangGraph. If it’s one straight shot, LCEL is enough.