Skip to content

VeriteraAI/forge-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@veritera.ai/forge-verify

Forge Verify SDK for JavaScript/TypeScript. Verify AI agent decisions with cryptographic attestation.

Install

npm install @veritera.ai/forge-verify

Quick Start

import { ForgeVerify } from "@veritera.ai/forge-verify";

const forge = new ForgeVerify({ apiKey: "vt_live_..." });

const result = await forge.verifyDecision({
  agentId: "agent-1",
  action: "payment.create",
  params: { amount: 100, currency: "USD" },
  policy: "finance-controls",
});

if (result.verified) {
  // Action approved — execute it
} else {
  console.log("Blocked:", result.reason);
}

API

new ForgeVerify(config)

Option Type Default Description
apiKey string required API key (vt_live_..., vt_sandbox_...)
baseUrl string https://forge.veritera.ai API base URL
timeout number 10000 Request timeout (ms)
maxRetries number 2 Retries on 5xx errors
failClosed boolean true Return denied instead of throwing on errors
debug boolean false Enable debug logging

Aliases: Forge, Veritera (backward compatibility)

Methods

  • verifyDecision(request) — Verify an agent action against policy
  • getProof(proofId) — Retrieve a verification proof
  • verifyProofLocally(verification) — Verify attestation offline (Ed25519)
  • createDelegation(request) — Create a scoped agent delegation
  • getUsage(period?) — Get billing usage stats
  • health() — Check API health

Error Handling

import { ForgeError, RateLimitError } from "@veritera.ai/forge-verify";

try {
  await forge.verifyDecision({ ... });
} catch (err) {
  if (err instanceof RateLimitError) {
    // Wait err.retryAfterMs before retrying
  } else if (err instanceof ForgeError) {
    console.log(err.code, err.status, err.message);
  }
}

Fail-Closed (Default)

When failClosed: true (default), network/server errors return a denied result instead of throwing. The agent is blocked, not crashed.

Circuit Breaker

After 5 consecutive failures, the SDK opens a circuit breaker for 30 seconds, immediately returning errors without hitting the API. After 30s, one request is allowed through (half-open). On success, the circuit closes.

Migrating from @veritera.ai/sdk

npm uninstall @veritera.ai/sdk
npm install @veritera.ai/forge-verify

Update imports:

// Before
import { Veritera } from "@veritera.ai/sdk";
// After (Veritera still works as alias)
import { ForgeVerify } from "@veritera.ai/forge-verify";

Requirements

  • Node.js >= 18.0.0
  • Works with CommonJS and ESM

Links

About

Forge Verify JavaScript/TypeScript SDK — Trust verification layer for AI agents. Zero dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors