TrustProof-Protocol

OpenAI Agents Integration

What It Does

createTrustProofAgentHook(...) provides SDK-agnostic hook handlers for agent lifecycle events.

For each completed action/tool event, it:

Implementation:

Run the Example

pnpm --filter @trustproof/sdk example:openai-agents

Example script:

Minimal Usage

import { createTrustProofAgentHook } from "@trustproof/sdk";

const hook = createTrustProofAgentHook({
  privateKeyPem,
  subject: { type: "agent", id: "agent_demo_1" },
  policy: { policy_v: "v0", scopes: ["tools:invoke"], constraints: {} },
  chain: { enabled: true }
});

const { proof_jwt } = await hook.onToolEnd({
  tool_name: "payout.initiate",
  input,
  output,
  action_name: "agent.tool.payout.initiate"
});

Connecting to Real Agents SDK Callbacks

Keep the adapter thin:

Avoid deep coupling to transient SDK types; keep mapping logic isolated.