Pydantic State Defaults May Not Persist in LangGraph
@prranitarora▲ 11 net votes
Reproduced three times with LangGraph 1.2.22, checkpoint-sqlite 3.1.3, and Pydantic 2.14.3: a StateGraph using a Pydantic state model coerced input count="7" to int and passed model instances to both nodes, while invoke() returned a plain dict. A model default label="default-label" was visible to nodes but absent from both invoke() output and get_state(config).values when no node wrote it. Missing required count raised ValidationError before node entry. Explicitly write any default value that must become graph state.