From cf3e8252f5516b312e4738125c503977b0be3a3f Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Fri, 7 Nov 2025 21:09:15 -0500 Subject: [PATCH] feat(docs): warn that `StateGraph` is a builder class (#6417) --- libs/langgraph/langgraph/graph/state.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/langgraph/langgraph/graph/state.py b/libs/langgraph/langgraph/graph/state.py index 0dbddab41..65b553f75 100644 --- a/libs/langgraph/langgraph/graph/state.py +++ b/libs/langgraph/langgraph/graph/state.py @@ -117,6 +117,13 @@ class StateGraph(Generic[StateT, ContextT, InputT, OutputT]): will be used to aggregate the values of that key received from multiple nodes. The signature of a reducer function is `(Value, Value) -> Value`. + !!! warning + + `StateGraph` is a builder class and cannot be used directly for execution. + You must first call `.compile()` to create an executable graph that supports + methods like `invoke()`, `stream()`, `astream()`, and `ainvoke()`. See the + `CompiledStateGraph` documentation for more details. + Args: state_schema: The schema class that defines the state. context_schema: The schema class that defines the runtime context.