@tensflare/langgraph

Installation

npm install @tensflare/langgraph

Overview

LangGraph middleware automatically records each agent node invocation as a Truss action with SHA-256 hashed inputs and outputs. It uses a fail-open strategy — the node executes normally even if the Truss API is unreachable.

API

TrussLangGraphMiddleware

import { TrussLangGraphMiddleware } from "@tensflare/langgraph";

const truss = new TrussLangGraphMiddleware({
  apiUrl: "...",
  apiKey: "...",
  mandateId: "...",
});

const wrappedFn = truss.wrap(myNodeFunction);

wrap<T>(fn: T): T

Wraps any async function, recording a langgraph_node action type on each invocation.

Key Features

  • Records langgraph_node action type
  • SHA-256 hashing of all inputs and outputs
  • Fail-open: node executes normally even if API unreachable
  • Full TypeScript support with generic type preservation