CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-langchain--langgraph

Low-level orchestration framework for building stateful, multi-actor applications with LLMs

Overview
Eval results
Files

error-handling.mddocs/guides/

Error Handling Guide

Error patterns and retry strategies.

Node-Level Error Handling

const resilientNode = async (state: State) => {
  try {
    const result = await riskyOperation(state.data);
    return { result, error: null };
  } catch (error) {
    return { result: null, error: error.message };
  }
};

Retry Policies

import { task } from "@langchain/langgraph";

const unreliableTask = task({
  name: "fetch",
  retry: {
    maxAttempts: 3,
    initialInterval: 1000,
    backoffFactor: 2,
    jitter: true,
    retryOn: (error) => error.message.includes("timeout")
  }
}, async (url: string) => {
  return await fetch(url).then(r => r.json());
});

Error Recovery Flows

const checkError = (state: State) => {
  return state.error ? "handleError" : "continue";
};

graph
  .addNode("process", processNode)
  .addNode("handleError", errorHandler)
  .addNode("continue", continueNode)
  .addConditionalEdges("process", checkError);

Handling Specific Errors

import {
  GraphRecursionError,
  GraphInterrupt,
  InvalidUpdateError
} from "@langchain/langgraph";

try {
  await graph.invoke(input);
} catch (error) {
  if (error instanceof GraphRecursionError) {
    console.error("Recursion limit exceeded");
  } else if (error instanceof InvalidUpdateError) {
    console.error("Invalid state update");
  } else if (error instanceof GraphInterrupt) {
    console.log("Execution interrupted");
  }
}

See: Types & Errors API for error classes.

Install with Tessl CLI

npx tessl i tessl/npm-langchain--langgraph@1.0.1

docs

index.md

tile.json