Mastering LangGraph – State Management – 01

Mastering LangGraph - State Management - 01

Using Pydantic model as state Previously, we might have used TypedDict the most, but Pydantic model is also a great choice. Let’s see how this type can serve as the graph state. Input Validation from langgraph.graph import StateGraph, START, END from typing_extensions import TypedDict from pydantic import BaseModel # Overall state of the graph (this … Read more

Differences Between LangChain and LangGraph

Differences Between LangChain and LangGraph

In the field of large models, LangChain and LangGraph are two frameworks that have attracted considerable attention. Both aim to help developers build applications using large language models (LLMs), but they differ significantly in design philosophy, architecture, functionality, and applicable scenarios. 1. Introduction to LangChain LangChain is a framework for developing applications powered by large … Read more

Mastering LangGraph: Controllability 03

Mastering LangGraph: Controllability 03

Combining control flow (edges) and state updates (nodes) can be very useful. For instance, you might want to execute state updates and decide which node to transition to next within the same node. LangGraph provides a way to achieve this by returning an object from the Command node function: def my_node(state: State) -> Command[Literal["my_other_node"]]: return … Read more

Mastering LangGraph Persistence

Mastering LangGraph Persistence

LangGraph Persistence allows for easy state persistence between graph execution (thread-level persistence) and threads (cross-thread persistence). This tutorial demonstrates how to add persistence to a graph. LangGraph has a built-in persistence layer that is implemented through checkpoints. When compiling a graph with a checkpoint, the checkpoint saves a snapshot of the graph’s state at each … Read more