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:163
Videos
11:57
LangGraph Crash Course #15 - What is StateGraph? - YouTube
13:21
LangGraph Explained for Beginners - YouTube
11:34
Building a Tool Calling Agent with Langgraph Stategraph - Part ...
16:58
Deep Dive into LangGraph – State & State Schema - YouTube
03:09:52
LangGraph Complete Course for Beginners – Complex AI Agents with ...
15:12
LangGraph state - YouTube
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 manages that state.
Reddit
reddit.com › r/langgraph › graph vs stategragh
r/LangGraph on Reddit: Graph vs Stategragh
May 20, 2025 -
What is the difference between Graph and StateGraph in LangGraph?
I noticed that Graph class does not take any state_schema input, is this the only difference?
PyPI
pypi.org › project › langgraph › 0.0.23
langgraph · PyPI
LangGraph is a library for building stateful, multi-actor applications with LLMs, built on top of (and intended to be used with) LangChain. It extends the LangChain Expression Language with the ability to coordinate multiple chains (or actors) ...
» pip install langgraph
Langchain
reference.langchain.com › javascript › langchain-langgraph › index › StateGraph
StateGraph | @langchain/langgraph | LangChain Reference
import { type BaseMessage, AIMessage, HumanMessage, } from "@langchain/core/messages"; import { StateGraph, Annotation } from "@langchain/langgraph"; // Define a state with a single key named "messages" that will // combine a returned BaseMessage or arrays of BaseMessages const StateAnnotation = Annotation.Root({ sentiment: Annotation<string>, messages: Annotation<BaseMessage[]>({ reducer: (left: BaseMessage[], right: BaseMessage | BaseMessage[]) => { if (Array.isArray(right)) { return left.concat(right); } return left.concat([right]); }, default: () => [], }), }); const graphBuilder = new StateGraph(StateAnnotation); // A node in the graph that returns an object with a "messages" key // will update the state by combining the existing value with the returned one.
Substack
iaee.substack.com › p › langgraph-intuitively-and-exhaustively
LangGraph — Intuitively and Exhaustively Explained
September 5, 2024 - Once we understand why LangGraph exists, we’ll explore the technology practically through something called a “State Graph”. We’ll use this state graph to build an agent which is capable of performing a complex task which requires the agent to deal with natural conversation, hard rules, and application logic.
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
Baihezi
baihezi.com › mirrors › langgraph › reference › graphs › index.html
Graphs - LangGraph
Graphs are the core abstraction of LangGraph. Each StateGraph implementation is used to create graph workflows.
DEV Community
dev.to › jamesli › langgraph-state-machines-managing-complex-agent-task-flows-in-production-36f4
LangGraph State Machines: Managing Complex Agent Task Flows in Production - DEV Community
November 19, 2024 - LangGraph helps us manage such workflows efficiently. States are like checkpoints in your task execution: from typing import TypedDict, List class ShoppingState(TypedDict): # Current state current_step: str # Cart items cart_items: List[str] # Total amount total_amount: float # User input user_input: str class ShoppingGraph(StateGraph): def __init__(self): super().__init__() # Define states self.add_node("browse", self.browse_products) self.add_node("add_to_cart", self.add_to_cart) self.add_node("checkout", self.checkout) self.add_node("payment", self.payment)