Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 6, 2026·2 min de lecture

LangGraph — Stateful AI Agent Graphs by LangChain

Framework for building stateful, multi-actor AI agent applications as directed graphs. Supports cycles, branching, persistence, and human-in-the-loop patterns. By LangChain. 8,000+ stars.

Introduction

LangGraph is a framework by LangChain for building stateful, multi-actor AI agent applications as directed graphs with 8,000+ GitHub stars. Unlike chain-based approaches, LangGraph supports cycles (agent loops), conditional branching, persistent state, and human-in-the-loop workflows. Define your agent logic as nodes and edges in a graph, and LangGraph handles state management, checkpointing, and error recovery. Best for building complex agent systems with non-linear workflows. Works with: Claude, GPT-4, any LangChain-supported model. Setup time: under 3 minutes.


Core Concepts

State Graph

Define your workflow as a directed graph:

graph = StateGraph(AgentState)
graph.add_node("plan", plan_step)
graph.add_node("execute", execute_step)
graph.add_node("review", review_step)

# Conditional routing
graph.add_conditional_edges("review", decide_next, {
    "revise": "execute",   # Loop back if needs revision
    "approve": END          # Finish if approved
})

Cycles (Agent Loops)

LangGraph supports loops — agents can iterate until satisfied:

plan → execute → review → execute → review → approve → END
                  ↑___________|
                  (revision loop)

Human-in-the-Loop

Pause execution for human approval:

from langgraph.checkpoint import MemorySaver

graph.add_node("human_review", interrupt_before=True)

# Agent pauses here, human reviews, then continues
app = graph.compile(checkpointer=MemorySaver())

Persistence

Checkpoint state for resuming later:

from langgraph.checkpoint.postgres import PostgresSaver

checkpointer = PostgresSaver(connection_string="...")
app = graph.compile(checkpointer=checkpointer)

# Resume from any checkpoint
result = app.invoke(None, config={"thread_id": "task-123"})

Multi-Agent Patterns

# Supervisor pattern: one agent delegates to specialists
supervisor = create_supervisor(
    agents=[researcher, coder, reviewer],
    model="claude-sonnet-4-20250514"
)

# Each agent is a subgraph node
graph.add_node("supervisor", supervisor)
graph.add_node("researcher", researcher_graph)
graph.add_node("coder", coder_graph)

Key Stats

  • 8,000+ GitHub stars
  • By LangChain team
  • Cycles and conditional branching
  • Persistent checkpointing
  • Human-in-the-loop support

FAQ

Q: What is LangGraph? A: LangGraph is a framework for building stateful AI agent applications as directed graphs with support for cycles, branching, persistence, and human-in-the-loop workflows.

Q: Is LangGraph free? A: Yes, open-source under MIT license. LangGraph Platform (managed hosting) is paid.

Q: How is LangGraph different from CrewAI? A: LangGraph uses graph-based control flow with explicit state management. CrewAI uses role-based agents with implicit orchestration. LangGraph offers finer-grained control.


🙏

Source et remerciements

Created by LangChain. Licensed under MIT.

langgraph — ⭐ 8,000+

Thanks to the LangChain team for making complex agent workflows manageable.

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires