🌐
Langchain
reference.langchain.com › python › langgraph › graph › state › StateGraph
StateGraph | langgraph | LangChain Reference
from langchain_core.runnables import RunnableConfig from typing_extensions import Annotated, TypedDict from langgraph.checkpoint.memory import InMemorySaver from langgraph.graph import StateGraph from langgraph.runtime import Runtime def reducer(a: list, b: int | None) -> list: if b is not None: return a + [b] return a class State(TypedDict): x: Annotated[list, reducer] class Context(TypedDict): r: float graph = StateGraph(state_schema=State, context_schema=Context) def node(state: State, runtime: Runtime[Context]) -> dict: r = runtime.context.get("r", 1.0) x = state["x"][-1] next_value = x * r * (1 - x) return {"x": next_value} graph.add_node("A", node) graph.set_entry_point("A") graph.set_finish_point("A") compiled = graph.compile() step1 = compiled.invoke({"x": 0.5}, context={"r": 3.0}) # {'x': [0.5, 0.75]}
🌐
LangChain
langchain-ai.github.io › langgraphjs › reference › classes › langgraph.StateGraph.html
StateGraph | LangGraph.js API Reference
Overrides Graph<N, S, U, StateGraphNodeSpec<S, U>, ToStateDefinition<C>>.constructor · Defined in libs/langgraph-core/dist/graph/state.d.ts:167
Discussions

Graph vs Stategragh
Read the docs! Just kidding I don’t think they exist, or I haven’t been able to find them. StateGraph merges the state for you from node to node, and enforces types. I use it for most of my work. Graph doesn’t have these features, so you can skip or implement yourself. More on reddit.com
🌐 r/LangGraph
3
1
May 20, 2025
langchain - Langgraph: Add a new state in graph - Stack Overflow
I have been tinkering with the langgraph supervisor multi agent example: https://github.com/langchain-ai/langgraph/blob/main/examples/multi_agent/agent_supervisor.ipynb. Let's say I have the below ... More on stackoverflow.com
🌐 stackoverflow.com
How to Manage State in LangGraph for Multiple Users?
hm maybe im not understanding, but typically we handle this with something like: https://langchain-ai.github.io/langgraph/how-tos/persistence/ basically, each thread is a separate conversation. so if you have a chatbot and there are multiple users, youd just create a separate thread for each user, and that state will be saved and loaded independently. unless by "multiple users" you meant multiple users in the same chat? More on reddit.com
🌐 r/LangChain
8
8
June 27, 2024
Am I the only one who feels LangGraph documentation and tutorials by lanfchain absolutely suck?
Yep, search documentation on this sub and you'll see a new post about it ever day. Thankfully, there's a youtube video for most topics More on reddit.com
🌐 r/LangChain
48
90
May 31, 2024
🌐
Medium
medium.com › ai-agents › langgraph-for-beginners-part-4-stategraph-794004555369
LangGraph for Beginners, Part 4: StateGraph. | by Santosh Rout | AI Agents | Medium
October 26, 2024 - State is one of the core components of LangGraph. A node takes state as input, updates it and pass it to the next node in the graph. So the next node takes the response from the previous node as input, updates it and pass it onto the next one.
🌐
Langchain
docs.langchain.com › oss › python › langgraph › graph-api
Graph API overview - Docs by LangChain
Edges: Functions that determine which Node to execute next based on the current state. They can be conditional branches or fixed transitions. By composing Nodes and Edges, you can create complex, looping workflows that evolve the state over time. The real power, though, comes from how LangGraph ...
🌐
Medium
medium.com › @diwakarkumar_18755 › understanding-langgraphs-stategraph-a-simple-guide-020f70fc0038
Understanding LangGraph’s StateGraph: A Simple Guide | by Diwakar Kumar | Medium
March 24, 2025 - LangGraph is a powerful framework that allows developers to define workflows as directed graphs. One of its core components is StateGraph, which enables efficient state management and execution flow control.
🌐
LangChain
blog.langchain.com › langgraph
LangGraph
January 17, 2024 - At it's core, LangGraph exposes a pretty narrow interface on top of LangChain. StateGraph is a class that represents the graph. You initialize this class by passing in a state definition.
🌐
Medium
medium.com › @gitmaxd › understanding-state-in-langgraph-a-comprehensive-guide-191462220997
Understanding State in LangGraph: A Beginners Guide 🚀 | by Rick Garcia | Medium
August 17, 2024 - State in LangGraph is a way to maintain and track information as an AI system processes data. Think of it as the system’s memory, allowing it to remember and update information as it moves through different stages of a workflow, or graph.
Find elsewhere
🌐
Langchain
reference.langchain.com › javascript › langchain-langgraph › index › StateGraph
StateGraph | @langchain/langgraph | LangChain Reference
const myNode = (state: typeof StateAnnotation.State) => { return { messages: [new AIMessage("Some new response")], sentiment: "positive", }; }; const graph = graphBuilder .addNode("myNode", myNode) .addEdge("__start__", "myNode") .addEdge("myNode", "__end__") .compile(); await graph.invoke({ messages: [new HumanMessage("how are you?")] }); // { // messages: [HumanMessage("how are you?"), AIMessage("Some new response")], // sentiment: "positive", // } ... addSequence→ StateGraph<SD, S, U, N | K, I, O, C, MergeReturnType<NodeReturnType, { [key in string]: NodeOutput }>>method
🌐
PyPI
pypi.org › project › langgraph › 0.0.23
langgraph · PyPI
# Initialize the StateGraph with this state graph = StateGraph(AgentState) # Create nodes and edges ...
      » pip install langgraph
    
Published   Feb 04, 2024
Version   0.0.23
🌐
GitHub
github.com › langchain-ai › langgraph
GitHub - langchain-ai/langgraph: Build resilient language agents as graphs. · GitHub
3 days ago - Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents.
Starred by 30.9K users
Forked by 5.3K users
Languages   Python
🌐
Medium
medium.com › @martin.hodges › defining-the-langgraph-state-47c5ef97a95c
Defining the LangGraph state. In a previous article, I introduced a… | by Martin Hodges | Medium
September 9, 2025 - When the LangGraph graph is built, the state object is associated with the graph: # Build graph graph_builder = StateGraph(GraphState) graph_builder.add_node(nodes...
🌐
Real Python
realpython.com › langgraph-python
LangGraph: Build Stateful AI Agents in Python – Real Python
November 15, 2024 - This is where LangGraph’s core object—the state graph—comes in to help. ... Now that you’ve built the notice parsing and escalation check chains, you need to orchestrate them and add additional functionality that your company requires to process notice emails. To do this, you’ll use LangGraph’s StateGraph to create a graph that builds upon NOTICE_PARSER_CHAIN and ESCALATION_CHECK_CHAIN.
🌐
DataCamp
datacamp.com › tutorial › langgraph-tutorial
LangGraph Tutorial: What Is LangGraph and How to Use It? | DataCamp
June 26, 2024 - Define a StateGraph object to structure the chatbot as a state machine. The State is a class object defined with a single key messages of type List and uses the add_messages() function to append new messages rather than overwrite them. from typing import Annotated from typing_extensions import ...
🌐
GettingStarted.ai
gettingstarted.ai › langgraph-tutorial-with-example
LangGraph Tutorial with Practical Example
November 24, 2024 - For example, a node can integrate with a large language model, process information, call an external API, or any other task. A LangGraph node takes the state of the graph as a parameter and returns an updated state after it is executed.