Skip to content

LangGraph

LangGraph is the stateful agent orchestration framework by LangChain. It models agent workflows as directed graphs — nodes are actions (LLM calls, tool calls, human review) and edges define the flow between them. Unlike chain-based approaches, LangGraph supports cycles, branching, and persistent state, which are essential for complex agent behaviors. MCP tools plug in as graph nodes.


LG
LangGraph
LangChain · langgraph docs
TRANSPORT
Streamable HTTP ✓
PLATFORM
Python · JavaScript · Framework
MCP VIA
ToolNode

Graph-Based Agent Workflows with MCP Nodes

LangGraph's graph model gives you precise control over agent behavior. You define states, transitions, and conditions explicitly — no magic, no hidden prompt engineering. Cycles let agents retry failed operations. Branching lets them pursue multiple strategies simultaneously. Persistent state means they can pause, resume, and be interrupted.

MCP tools become ToolNodes in the graph. An agent node reasons about what to do, routes to the appropriate MCP ToolNode, processes the result, and decides the next step. The graph structure makes this flow transparent and debuggable.

Core features:

  • Directed graph model — explicit states, transitions, and conditions
  • Cycles and branching — agents retry, backtrack, and pursue parallel paths
  • Persistent state — pause, resume, and time-travel through agent execution
  • Human-in-the-loop — interrupt nodes for human review and approval
  • Streaming — real-time output of agent reasoning and tool results
  • LangSmith integration — trace, debug, and monitor graph execution
  • Python and JS — first-class support in both languages

Adding MCP Tools to Your Graph

1. Create a Token

In Vinkius Cloud, go to your server → Connection TokensCreate. Copy the URL.

2. Create a ToolNode

python
from langgraph.prebuilt import ToolNode
from langchain_mcp import MCPToolkit

toolkit = MCPToolkit(url="https://edge.vinkius.com/{TOKEN}/mcp")
tool_node = ToolNode(toolkit.get_tools())

# Add to your state graph
graph.add_node("tools", tool_node)
graph.add_edge("agent", "tools")
graph.add_edge("tools", "agent")

3. Run the Graph

Execute the graph. The agent node routes to MCP tools as part of its reasoning loop.


FAQ

How do MCP tools fit into the LangGraph model? MCP tools are wrapped as a ToolNode in the directed graph. The agent node decides when to call tools, routes to the ToolNode, and processes results — all as explicit graph transitions.

Can I combine MCP with LangChain tools? Yes. ToolNodes can contain both MCP tools and native LangChain tools. The agent selects from all available tools.

Does LangGraph support persistent state with MCP? Yes. Graph state — including MCP tool call history — is persisted. You can pause, resume, or replay agent sessions.

Is LangGraph free? Open-source. LangSmith (monitoring) has free and paid tiers.