For: LangChain devs who want every chain step audit-grade

LangChain — sign every tool-use decision

~7 min · prereqs: LangChain 0.3+ (TS or Python) · running SBO3L daemon

  1. 1

    Install the LangChain adapter

    Drop-in callback handler — no chain code changes.

    pnpm add @sbo3l/langchain  # or: pip install sbo3l-langchain
  2. 2

    Add the callback handler

    Every tool invocation flows through the SBO3L policy boundary first.

    import { Sbo3lCallbackHandler } from "@sbo3l/langchain";
    
    const handler = new Sbo3lCallbackHandler({
      url: "http://localhost:8730",
      agentId: "research-01",
      onDeny: (reason) => console.warn("policy deny:", reason),
    });
    
    const result = await chain.invoke({ input }, { callbacks: [handler] });
  3. 3

    Inspect the receipts

    Each tool call writes a receipt. Pull them all from the chain context.

    const receipts = handler.receipts;
    console.log(receipts.length, "tool calls,", receipts.filter(r => r.outcome === "deny").length, "denied");