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:
- Explicit config object passed to
secure() - Environment variables with
PAVRI_prefix - Built-in defaults
| Env Variable | Config Field | Default |
|---|---|---|
PAVRI_API_KEY | api_key | — |
PAVRI_BACKEND_URL | backend_url | http://localhost:8080 |
PAVRI_AGENT_NAME | agent_name | — |
PAVRI_TEAM | team | — |
PAVRI_ENVIRONMENT | environment | development |
PAVRI_ORG_ID | org_id | — |
What Happens
When you call secure(), the SDK:
- Connects to the Pavri backend
- Registers your agent with a unique fingerprint
- Fetches the latest policy snapshot
- Instruments your agent with telemetry and policy hooks
- Emits a registration lifecycle event
Your agent then appears in the Pavri dashboard under Agents.
Next Steps
- Policy Configuration — learn about the Pavri platform and how policies work
- Discovery — understand how Pavri finds unmonitored agents
- Architecture Overview — learn about the Pavri platform