What is state in LangGraph?

State is the shared data a LangGraph graph’s nodes read and update. You define it as a TypedDict, a dataclass, or a Pydantic BaseModel, and every node works against that one object instead of passing values to the next node directly.

A node doesn’t return the full state. It returns a partial update, and LangGraph applies it key by key through that key’s reducer. Without a reducer the default replaces the old value, so a node that writes messages overwrites messages and leaves every other key alone. Attach a reducer such as an append function with Annotated, and the update merges into the old value instead.

That is why state is the thing to grade. Each node’s output is a diff against a shared object, so a wrong value can sit untouched in a key for several steps before a later node reads it. A final answer alone won’t show you which step wrote it, and a trace of the run is what lets you find that step.

One limit: a node can write to any channel in the graph state, including keys outside its declared input schema, so a node’s inputs don’t bound what it can change.

published

sources

keep reading

More on this.

Try Tessary on Cloud.

free · 10,000 traces a month · 1 GB · 30-day retention · $10 one-time credit for triage and RCA · no credit card