LangGraph 1 · Building graphs
Define the state
Describe the data that flows through the graph. add_messages appends new messages instead of replacing the list.
from typing import Annotated
from typing_extensions import TypedDict
from langgraph.graph.message import add_messages
class State(TypedDict):
messages: Annotated[list, add_messages]
Official LangGraph 1 documentation