Skip to main content
The VaultGraph SDK is designed to be a lightweight wrapper around your existing agent logic. It handles the cryptography, receipt generation, and submission to the VaultGraph network.

Installation

npm install @vaultgraph/sdk

Usage Example

Here is how you might integrate VaultGraph into a typical agent loop.
import { VaultGraph } from '@vaultgraph/sdk';

// 1. Initialize the client with your vendor key
const client = new VaultGraph({
  apiKey: process.env.VAULTGRAPH_API_KEY,
  privateKey: process.env.VENDOR_PRIVATE_KEY, // Used to sign receipts locally
});

async function onAgentCompletion(job) {
  // 2. Your agent finishes work
  const result = await myAgent.run(job.input);

  // 3. Create and submit a verifiable receipt
  const receipt = await client.receipts.create({
    agentId: 'agent_refund_bot_v1',
    consumerId: 'org_acme_corp',
    jobId: job.id,
    
    // The outcome you want to prove
    status: 'success',
    metadata: {
      latencyMs: 450,
      tokensUsed: 120,
      costUsd: 0.02
    },

    // Privacy-preserving verification
    // You keep the transcript; VaultGraph only stores the hash
    contextHash: client.utils.hash(job.transcript),
  });

  console.log(`Receipt minted: ${receipt.id}`);
}

Key Features

  • Local Signing: Receipts are signed on your infrastructure before being sent.
  • Zero-Knowledge Context: We verify the existence of the work without seeing the content of the work.
  • Async Batching: High-volume agents can batch receipts to save bandwidth.