Skip to main content

TypeScript SDK Quickstart

Get started with Pavri in a Node.js application in under 5 minutes.

Prerequisites

  • Node.js >= 24.0.0
  • A running Pavri backend (local or hosted)

Installation

npm install @pavri/sdk

Basic Usage

import { secure, type PavriConfig } from "@pavri/sdk";

// Your agent (any object or class instance)
const myAgent = {
name: "my-agent",
async run(input: string) {
// agent logic here
return `Processed: ${input}`;
}
};

// Wrap with Pavri governance
const securedAgent = await secure(myAgent, {
agent_name: "my-agent",
backend_url: "http://localhost:8080",
environment: "development",
team: "my-team",
});

// Use your agent normally — telemetry and policy enforcement are automatic
const result = await securedAgent.run("Hello");

Configuration

The SDK reads configuration from:

  1. Explicit config object passed to secure()
  2. Environment variables with PAVRI_ prefix
  3. Built-in defaults
Env VariableConfig FieldDefault
PAVRI_API_KEYapi_key
PAVRI_BACKEND_URLbackend_urlhttp://localhost:8080
PAVRI_AGENT_NAMEagent_name
PAVRI_TEAMteam
PAVRI_ENVIRONMENTenvironmentdevelopment
PAVRI_ORG_IDorg_id

What Happens

When you call secure(), the SDK:

  1. Connects to the Pavri backend
  2. Registers your agent with a unique fingerprint
  3. Fetches the latest policy snapshot
  4. Instruments your agent with telemetry and policy hooks
  5. Emits a registration lifecycle event

Your agent then appears in the Pavri dashboard under Agents.

Next Steps