本页还没有译文
本页 27 段还没译成Español,下面显示的是英文原文。What's new in LangGraph v1
还没翻译译自英文(docs.langchain.com)本页 27 段都还没译
LangGraph v1 is a stability-focused release for the agent runtime. It keeps the core graph APIs and execution model unchanged, while refining type safety, docs, and developer ergonomics.
It's designed to work hand-in-hand with LangChain v1 (whose createAgent is built on LangGraph) so you can start high-level and drop down to granular control when needed.
Stable core APIs
Graph primitives (state, nodes, edges) and the execution/runtime model are unchanged, making upgrades straightforward.
Reliability, by default
Durable execution with checkpointing, persistence, streaming, and human-in-the-loop continues to be first-class.
Seamless with LangChain v1
LangChain's createAgent runs on LangGraph. Use LangChain for a fast start; drop to LangGraph for custom orchestration.
To upgrade,
npmpnpmyarnbun
npm install @langchain/langgraph @langchain/corepnpm add @langchain/langgraph @langchain/coreyarn add @langchain/langgraph @langchain/corebun add @langchain/langgraph @langchain/coreFor a complete list of changes, see the migration guide.
Deprecation of createReactAgent
The LangGraph createReactAgent prebuilt has been deprecated in favor of LangChain's createAgent. It provides a simpler interface, and offers greater customization potential through the introduction of middleware.
- For information on the new
createAgentAPI, see the LangChain v1 release notes. - For information on migrating from
createReactAgenttocreateAgent, see the LangChain v1 migration guide.
Typed interrupts
StateGraph now accepts a map of interrupt types in the constructor to more closely constrain the types of interrupts that can be used within a graph.
import { StateGraph, MemorySaver, interrupt } from "@langchain/langgraph";
import * as z from "zod";
const stateSchema = z.object({
foo: z.string(),
})
const graphConfig = {
interrupts: {
// Define a simple interrupt that accepts a reason and returns messages
simple: interrupt<{ reason: string }, { messages: string[] }>, // [!code highlight]
// Define a complex interrupt with the same signature
complex: interrupt<{ reason: string }, { messages: string[] }>, // [!code highlight]
}
}
const checkpointer = new MemorySaver();
const graph = new StateGraph(stateSchema, graphConfig)
.addNode("node", async (state, runtime) => {
// Trigger the simple interrupt with a reason
const response = runtime.interrupt.simple({ reason: "test" });
// Return the interrupt response as the new state
return { foo: response };
})
// Compile the graph with the checkpointer
.compile({ checkpointer });
// Invoke the graph with initial state
const result = await graph.invoke({ foo: "test" });
// Access the interrupt data
if (graph.isInterrupted(result)) {
console.log(result.__interrupt__.messages);
}For more information on interrupts, see the Interrupts documentation.
Frontend SDK enhancements
LangGraph v1 comes with a few enhancements when interacting with a LangGraph application from the frontend.
Event stream encoding
The low-level toLangGraphEventStream helper has been removed. Streaming responses are now handled natively by the SDK, and you can select the wire format via passing in the encoding format to graph.stream. This makes switching between SSE and normal JSON responses straightforward without changing UI logic.
See the migration guide for more information.
Custom transports in useStream
The React useStream hook now supports pluggable transports so you can have more control over the network layer without changing UI code.
const stream = useStream({
transport: new FetchStreamTransport({
apiUrl: "http://localhost:2024",
}),
});Learn how to integrate and customize the hook: Integrate LangGraph into your React application.
Reporting issues
Please report any issues discovered with 1.0 on GitHub using the 'v1' label.
Additional resources
Read the announcement
What LangGraph is and when to use it
Build graphs with state, nodes, and edges
High-level agents built on LangGraph
How to migrate to LangGraph v1
Report issues or contribute
See also
- Versioning – Understanding version numbers
- Release policy – Detailed release policies