langgraph

작성자: langchain-ai

LangGraph를 사용하여 상태 저장이 가능하고 내구성 있는 에이전트 워크플로우를 구축하세요. 사용자 정의 그래프 기반 제어 흐름, 인간 개입, 지속성 또는 다중 에이전트가 필요할 때 사용하십시오.

npx skills add https://github.com/langchain-ai/docs --skill langgraph

LangGraph

LangGraph is a low-level orchestration framework and runtime for building, managing, and deploying long-running, stateful agents. It provides durable execution, streaming, human-in-the-loop interactions, and time-travel debugging.

When to use

Use LangGraph when you need to:

  • Design custom agent workflows with explicit graph-based control flow
  • Add durable execution so agents survive failures and restarts
  • Implement human-in-the-loop with interrupts and approval steps
  • Build multi-agent systems with state shared across agents
  • Stream intermediate results from long-running agent tasks
  • Time-travel debug by replaying agent execution from any checkpoint

When NOT to use

  • For a simple tool-calling agent, use LangChain agents instead—less boilerplate for common patterns
  • For a batteries-included agent with planning and subagents, use Deep Agents instead
  • LangGraph is the orchestration layer—use it when you need fine-grained control over agent behavior

Install

# Python
pip install -U langgraph

# JavaScript/TypeScript
npm install @langchain/langgraph @langchain/core

Quick reference

Graph API (recommended for most use cases)

from langgraph.graph import StateGraph, MessagesState, START, END

def my_node(state: MessagesState):
    return {"messages": [{"role": "ai", "content": "hello world"}]}

graph = StateGraph(MessagesState)
graph.add_node(my_node)
graph.add_edge(START, "my_node")
graph.add_edge("my_node", END)
graph = graph.compile()

result = graph.invoke(
    {"messages": [{"role": "user", "content": "Hello!"}]}
)

Functional API (for simple pipelines)

from langgraph.func import entrypoint, task

@task
def step_one(input: str) -> str:
    return f"processed: {input}"

@entrypoint()
def pipeline(input: str) -> str:
    return step_one(input).result()

Add human-in-the-loop

from langgraph.types import interrupt

def human_approval(state: MessagesState):
    answer = interrupt({"question": "Approve this action?"})
    return {"messages": [{"role": "user", "content": answer}]}

Key concepts

ConceptDescription
StateGraphDefine nodes and edges that form your agent's control flow
MessagesStateBuilt-in state schema for chat-based agents
compile()Compile a graph builder into an executable graph
interrupt()Pause execution and wait for human input
CheckpointerPersist state for durable execution and time-travel
Graph API vs Functional APIGraph API for complex workflows; Functional API for linear pipelines

Key documentation

API reference

For SDK class and method details, use the LangChain API Reference site:

  • Browse: https://reference.langchain.com/python/langgraph
  • MCP server: https://reference.langchain.com/mcp

Related skills

  • langchain—Core building blocks for models, tools, and simple agents
  • deep-agents—High-level agent harness built on LangGraph
  • langsmith—Trace, evaluate, and deploy your LangGraph agents

langchain-ai의 다른 스킬

deepagents-thread-inspector
langchain-ai
로컬 Deep Agents Code SQLite 세션 저장소의 대화를 검사하고 설명합니다. LangSmith 추적 도구를 사용할 수 없을 때 대체 수단으로 사용하며, …
deepagents-python-quickstart
langchain-ai
공식 퀵스타트를 따라 Python으로 최소한의 로컬 Deep Agent를 구축하고, Tavily 대신 공급자 기본 웹 검색을 사용합니다. 사용자가 다음을 원할 때 사용합니다…
deepagents-typescript-quickstart
langchain-ai
공식 퀵스타트를 따라 TypeScript로 최소한의 로컬 Deep Agent를 스캐폴드하고, Tavily 대신 제공자 네이티브 웹 검색을 사용합니다. 사용자가…
eval-engineering
langchain-ai
에이전트 저장소와 사용자가 제공한 선택적 트레이스를 반복적으로 검사하고, 사용자와 인터뷰하며, Harbor 평가를 한 번에 하나씩 생성, 실행, 감사합니다. 용도:…
LangChain RAG Pipeline
langchain-ai
이 스킬을 호출하여 검색 증강 생성(RAG) 시스템을 구축하세요. 문서 로더, RecursiveCharacterTextSplitter, 임베딩(OpenAI) 등을 다룹니다.
LangChain Structured Output & HITL
langchain-ai
langchain-structured-output-&-hitl — AI 에이전트를 위한 설치 가능한 스킬로, langchain-ai/langchain-skills에서 게시되었습니다.
LangSmith Datasets
langchain-ai
이 스킬은 평가 데이터셋을 트레이스에서 생성하거나 LangSmith에 데이터셋을 업로드하거나 데이터셋을 쿼리할 때 호출하세요. 데이터셋 유형(final_response, …)을 다룹니다.
langsmith-evaluator
langchain-ai
LangSmith 평가 파이프라인을 구축할 때 이 스킬을 호출하세요. 세 가지 핵심 구성 요소를 다룹니다: (1) 평가자 생성 - LLM-as-Judge, 사용자 정의 코드; (2)…