Skip to main content

Documentation Index

Fetch the complete documentation index at: https://nvd-54.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

你的 LangGraph StateGraph 在达到停止条件之前达到了最大步骤数。 这通常是由于如下示例代码导致的无限循环引起的:
import { StateGraph, StateSchema } from "@langchain/langgraph";
import { z } from "zod/v4";

const State = new StateSchema({
  someKey: z.string(),
});

const builder = new StateGraph(State)
  .addNode("a", ...)
  .addNode("b", ...)
  .addEdge("a", "b")
  .addEdge("b", "a")
  ...

const graph = builder.compile();
然而,复杂的图可能自然地达到默认限制。

故障排除

  • 如果你不期望图经过很多次迭代,你可能有一个循环。检查你的逻辑是否存在无限循环。
  • 如果你有一个复杂的图,可以在调用图时在 config 对象中传入更高的 recursionLimit 值:
await graph.invoke({...}, { recursionLimit: 100 });