wrapToolWithTrustProof(...) wraps a LangChain tool call and emits a TrustProof JWT per invocation.
For each call, it:
input and outputgenerate(...)Implementation:
pnpm --filter @trustproof/sdk example:langchain
Example script:
import { wrapToolWithTrustProof } from "@trustproof/sdk";
const wrapped = wrapToolWithTrustProof(tool, {
privateKeyPem,
subject: { type: "agent", id: "agent_demo_1" },
action: "agent.tool.payout.quote",
resource: { type: "tool", id: "payout.quote" },
policy: { policy_v: "v0", scopes: ["tools:invoke"], constraints: {} }
});
const { output, proof_jwt } = await wrapped.invoke(input);
Use stable, parseable action names:
agent.tool.<domain>.<operation>agent.tool.payout.quote, agent.tool.payout.initiate