Skip to main content
Docs

Integration guide

LangChain events, sealed as receipts.

Add RANKIGI beside a LangChain executor and witness the invocation without making your agent depend on the proof layer.

terminal
npm install @rankigi/langchain @rankigi/sdk @langchain/core

Detailed trace

Use the callback handler for lifecycle receipts.

Tool start, tool end, agent action, LLM end, and errors can each become chain entries.

langchain-callback.ts
import "dotenv/config";
import { createRankigiCallback } from "@rankigi/langchain";
import { AgentExecutor } from "langchain/agents";

// Reads RANKIGI_API_KEY / RANKIGI_AGENT_ID / RANKIGI_PASSPORT_ID /
// RANKIGI_SIGNING_KEY from the environment and manages its own SDK.
const executor = new AgentExecutor({
  agent,
  tools,
  callbacks: [createRankigiCallback({ agentTag: "research-agent" })],
});

await executor.invoke({ input: "summarize this matter" });

Compact trace

Use wrap() for one receipt per run.

This is the safer default when reviewers need proof of the run but not every internal LangChain callback.

langchain-wrap.ts
import "dotenv/config";
import { Rankigi } from "@rankigi/sdk";

const rankigi = Rankigi.fromEnv();

const input = { input: "summarize this matter" };
const result = await rankigi.wrap(
  "langchain-run",
  input,
  () => executor.invoke(input),
);

await rankigi.close();
console.log(result);

Behavior

Callback handlerOne receipt per LangChain lifecycle event when you need detailed trace coverage.
wrap()One receipt per invocation when you want a compact chain entry.
Failure modeSDK transport failures do not block the agent run.
Data boundarySubmit metadata and hashes by default. Do not send raw sensitive payloads.