# LangGraph — Build Stateful AI Agents as Graphs > LangChain framework for building resilient, stateful AI agents as graphs. Supports cycles, branching, persistence, human-in-the-loop, and streaming. 28K+ stars. ## Install Save as a script file and run: ## Quick Use ```bash pip install langgraph ``` ```python from langgraph.graph import StateGraph, START, END def chatbot(state): return {"messages": [llm.invoke(state["messages"])]} graph = StateGraph({"messages": list}) graph.add_node("chatbot", chatbot) graph.add_edge(START, "chatbot") graph.add_edge("chatbot", END) app = graph.compile() ``` --- ## Intro LangGraph is a framework by LangChain for building stateful, multi-actor AI agent applications modeled as graphs. Unlike simple chain-based workflows, LangGraph supports cycles, conditional branching, state persistence, human-in-the-loop interactions, and streaming — essential for production agents. 28,000+ GitHub stars. **Best for**: Developers building complex, stateful AI agents that need persistence and human oversight **Works with**: OpenAI, Anthropic, Google, any LangChain-supported model --- ## Key Concepts ### State Graphs Define agent logic as a directed graph with nodes (functions) and edges (transitions): ```python graph.add_node("research", research_fn) graph.add_node("write", write_fn) graph.add_conditional_edges("research", route_fn, {"done": "write", "more": "research"}) ``` ### Persistence & Checkpoints Save and resume agent state across sessions: ```python from langgraph.checkpoint.memory import MemorySaver app = graph.compile(checkpointer=MemorySaver()) ``` ### Human-in-the-Loop Pause execution for human approval before critical actions: ```python graph.add_node("approve", interrupt_before=True) ``` ### Streaming Stream intermediate results, tool calls, and token-by-token output. ### LangGraph Platform Deploy agents as scalable APIs with built-in monitoring via LangGraph Cloud. --- ### FAQ **Q: What is LangGraph?** A: A LangChain framework for building stateful AI agents as directed graphs, with support for cycles, persistence, human-in-the-loop, and streaming. 28K+ GitHub stars. **Q: Do I need LangChain to use LangGraph?** A: LangGraph can work standalone, but integrates seamlessly with LangChain for model providers, tools, and retrievers. --- ## Source & Thanks > Created by [LangChain](https://github.com/langchain-ai). Licensed under MIT. > [langchain-ai/langgraph](https://github.com/langchain-ai/langgraph) — 28,000+ GitHub stars --- Source: https://tokrepo.com/en/workflows/cc1a6ed2-0d82-4379-94f4-15632b4d4967 Author: TokRepo Curated