en un clic
langgraph
// Build stateful, durable agent workflows with LangGraph. Use when you need custom graph-based control flow, human-in-the-loop, persistence, or multi-agent orchestration.
// Build stateful, durable agent workflows with LangGraph. Use when you need custom graph-based control flow, human-in-the-loop, persistence, or multi-agent orchestration.
Use this skill when migrating inline code samples from LangChain docs (MDX files) into external, testable code files that are extracted by this repo’s snippet scripts and used as Mintlify snippets. Applies when extracting code blocks from documentation, creating runnable code samples, using snippet delineators, or wiring snippet output into MDX includes.
Build batteries-included agents with planning, context management, subagent delegation, and sandboxed execution. Use for complex, multi-step tasks that need built-in capabilities.
Build agents with a prebuilt architecture and integrations for any model or tool. Use when creating tool-calling agents, switching model providers, or adding structured output.
Trace, evaluate, and deploy AI agents and LLM applications with LangSmith. Use when adding observability, running evaluations, engineering prompts, or deploying agents to production.
Use when the user wants the current date and time written to a file via the bundled script inside the sandbox.
| name | langgraph |
| description | Build stateful, durable agent workflows with LangGraph. Use when you need custom graph-based control flow, human-in-the-loop, persistence, or multi-agent orchestration. |
| license | MIT |
| compatibility | Python 3.10+, Node.js 20+ |
| metadata | {"author":"langchain-ai","version":"1.0"} |
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.
Use LangGraph when you need to:
# Python
pip install -U langgraph
# JavaScript/TypeScript
npm install @langchain/langgraph @langchain/core
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!"}]}
)
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()
from langgraph.types import interrupt
def human_approval(state: MessagesState):
answer = interrupt({"question": "Approve this action?"})
return {"messages": [{"role": "user", "content": answer}]}
| Concept | Description |
|---|---|
StateGraph | Define nodes and edges that form your agent's control flow |
MessagesState | Built-in state schema for chat-based agents |
compile() | Compile a graph builder into an executable graph |
interrupt() | Pause execution and wait for human input |
| Checkpointer | Persist state for durable execution and time-travel |
| Graph API vs Functional API | Graph API for complex workflows; Functional API for linear pipelines |
For SDK class and method details, use the LangChain API Reference site:
https://reference.langchain.com/python/langgraphhttps://reference.langchain.com/mcp