Skip to main content

Installation

npm install provenlog
Requirements: Node.js 18+

Basic usage

import { ProvenLogClient } from "provenlog";

const client = new ProvenLogClient("http://localhost:7600", {
  agentId: "my-agent",
});

client.logEvent({
  action_type: "TOOL_CALL",
  action_name: "fetch_data",
  action_input: { query: "revenue Q4" },
  action_status: "success",
  action_output: { results: 42 },
});

await client.close();

Client configuration

const client = new ProvenLogClient("http://localhost:7600", {
  agentId: "my-agent",        // Default agent ID
  sessionId: "session-123",   // Default session ID
  metadata: { env: "prod" },  // Default metadata
  labels: { dept: "finance" },// Default labels
  batchSize: 100,             // Events per batch
  flushInterval: 1000,        // Milliseconds between flushes
  timeout: 30000,             // HTTP timeout in ms
  apiKey: "your-key",         // Bearer token for auth
});
The TypeScript SDK currently operates in server mode only. Start a plog serve instance and point the client at it.

Logging events

client.logEvent({
  action_type: "TOOL_CALL",
  action_name: "search_database",
  action_input: { query: "revenue Q4" },
  action_output: { results: 42 },
  action_status: "success",
  duration_ms: 150,
  metadata: { model: "claude-sonnet-4-5-20250929" },
  labels: { env: "prod" },
});

Lifecycle

// Flush pending events
await client.flush();

// Clean shutdown
await client.close();