@tensflare/langgraph
v0.1.0
Published
LangGraph middleware that injects Truss recording into agent loop steps
Readme

@tensflare/langgraph
LangGraph middleware — automatically records every LangGraph node invocation as a Truss action.
What is Truss?
Truss is an accountability layer for AI agents — it records every agent action as a cryptographically signed, tamper-evident audit trail. Learn more →
Overview
Wrap any LangGraph node function to automatically compute SHA-256 hashes of its inputs and outputs and POST a langgraph_node action record to the Truss API. Fail-open — if the Truss API is unreachable, the node still executes normally.
Installation
npm install @tensflare/langgraphQuick start
import { TrussLangGraphMiddleware } from "@tensflare/langgraph";
const truss = new TrussLangGraphMiddleware({
apiUrl: "http://localhost:4000",
apiKey: "tr_your_api_key",
mandateId: "mnd_001",
});
// Wrap any LangGraph node function
const wrappedNode = truss.wrap(myLangGraphNode);API
new TrussLangGraphMiddleware(options)
| Option | Type | Description |
|---|---|---|
| apiUrl | string | Truss API base URL |
| apiKey | string | Truss API key (tr_ prefix) |
| mandateId | string | Mandate ID to record actions under |
middleware.wrap(fn)
Wraps an async function (input: unknown) => Promise<unknown>. Records a langgraph_node action on each invocation with SHA-256 hashes of the input and output.
Related packages
| Package | Description | |---|---| | @tensflare/truss-sdk | TypeScript SDK for creating mandates and managing evidence | | @tensflare/tap | Core Zod schemas underlying action records | | @tensflare/autogen | AutoGen middleware (same pattern) | | @tensflare/crewai | CrewAI middleware (same pattern) |
Development
npm install
npm run build
npm testContributing
Pull requests are welcome. Please see the contribution guidelines.
License
Apache 2.0 — see LICENSE.
