- sign and submit deployment-scoped JobReceipts from your backend
- integrate VaultGraph with LangChain.js or the Vercel AI SDK
- manage agents through the VaultGraph API
- verify exported receipt signatures offline
Install
npm install @vaultgraph/sdk or yarn add @vaultgraph/sdk.
Before you start
Before you submit receipts, make sure you have:- Signed up at app.vaultgraph.com and created your organization
- Followed the full Setup flow
- Created an agent in the platform or via the API
- Created a deployment for that agent in the portal UI
- Registered your public key as an active signing key on that deployment
deploymentId.
In practice, most integrations need these environment variables:
VAULTGRAPH_API_KEYVAULTGRAPH_DEPLOYMENT_IDVAULTGRAPH_PRIVATE_KEY
generateKeyPair().
Quick start
Submit your first signed receipt in under 10 lines:JobReceipt, signs it with your Ed25519 private key, derives the matching public key automatically, and submits the signed payload to VaultGraph.
Choose an integration style
Use whichever path matches your application:- core SDK helpers if you want explicit control over receipt creation and submission
@vaultgraph/sdk/langchainif you use LangChain.js callbacks@vaultgraph/sdk/aiif you use Vercel AI SDK middleware@vaultgraph/mcp-serverif MCP-compatible clients should submit receipts through a standalone server
deriveJobId(...), deriveMetadata(...), and deriveResolution(...) hooks so you can align VaultGraph receipts with your own run IDs, metadata, and outcome rules.
Idempotency and duplicate suppression
The autogenerated integration job IDs (lc-* and ai-*) are convenient for local testing, but they are not retry-safe. If the same logical job can be retried, replayed, or resumed, provide deriveJobId(...) and return a stable vendor-controlled identifier.
Recommended pattern:
- reuse the same
job_idfor the same logical job across retries - put attempt counters, worker IDs, or retry reasons in
metadata, not injob_id - if one framework invocation can emit multiple integration events, decide whether you want one receipt per logical job or one receipt per framework event, then encode that intentionally in
job_id
- LangChain: use
context.runIdor a request ID passed through chain inputs - AI SDK: create middleware inside the request or job boundary and close over your own request ID
includeNestedRuns: true only if you intentionally want one receipt per nested callback as well.
Manual receipt flow
If you need more control than the one-liner above, create, sign, verify, and submit receipts separately:Create and sign without submitting
Verify exported receipts
If you export receipts from the platform as JSON, each item includes the canonicalreceipt payload and its signature. You can verify them offline with the public key that was registered on the deployment:
Manage agents
Use the agents client for control-plane operations against/api/agents:
deploymentId when submitting receipts.
API reference
Receipt functions
| Function | Description |
|---|---|
hashContext(value, options?) | SHA-256 hash of canonical JSON or bytes |
createReceipt(input) | Build a normalized JobReceipt |
serializeReceipt(receipt) | Canonical JSON string of a receipt |
signReceipt(options) | Sign a receipt and return a base64 signature |
verifyReceipt(options) | Verify a receipt signature and return a boolean |
createSignedReceipt(options) | Create and sign in one step |
submitSignedReceipt(options) | Create, sign, and submit in one step |
submitReceipt(options) | POST a signed receipt to /api/receipts |
generateKeyPair() | Generate a PEM-encoded Ed25519 key pair |
Client factories
| Function | Description |
|---|---|
createAgentsClient(options) | CRUD for /api/agents |
Types
Receipts:CreateReceiptInput, JobReceipt, JobReceiptV0, JobResolution, ReceiptVersion, SubmitReceiptOptions, SubmitReceiptResponse, CreateSignedReceiptOptions, SubmitSignedReceiptOptions, ApiError
Agents: AgentRecord, AgentCreateInput, AgentUpdateInput, AgentsClient, AgentsClientOptions
Important notes
- Never send raw context: hash it locally with
hashContext()first - Server-side only: keep your private key and API key out of browser code
- Deployment key pinning: submitted
publicKeyvalues must match an active signing key registered on the target deployment - Receipt version: the current receipt format is
v0; breaking changes will bump the major SDK version - Ed25519 only: RSA and ECDSA are not supported for receipt signing
Links
- Platform: app.vaultgraph.com
- Website: vaultgraph.com
- npm: @vaultgraph/sdk