Documentation

Documentation / Node SDK

Node SDK

This package is open source (MIT). The Guardonic API and other products are not.

The @guardonic/sdk package sends run payloads to your Guardonic API using POST /v1/ingest and the x-api-key header. Use any base URL your deployment provides (for example https://api.example.com).

Install

When published to npm:

$ npm install @guardonic/sdk

Until then, clone the SDK repository and use npm link, or depend on the package path in a monorepo.

Usage

import { Guardonic } from "@guardonic/sdk";

const client = new Guardonic({
apiKey: process.env.GUARDONIC_API_KEY!,
baseUrl: "https://your-guardonic-api.example",
});

await client.ingest({
agent: "support-bot",
status: "completed",
events: [
{
type: "llm",
label: "Request",
detail: "gpt-4o · 1200 tok",
},
],
});
  • ingest() resolves to { ok: true, runId }.
  • Omit runId to let the API assign one; repeat the same runId to append events to an existing run.
  • Each event supports type, label, detail, and optional at (ISO timestamp).

Environment

At minimum your process needs the API key and base URL your operator gives you. Example:

GUARDONIC_API_KEY=••••••••
# base URL is passed to Guardonic()