Skip to content

TypeScript / JavaScript SDK

Kaizen for the JS and TypeScript world, including the Vercel AI SDK.

npm install kaizen-security

Inspect an action

import { Kaizen } from "kaizen-security";

const kz = new Kaizen({ apiKey: "kz_live_...", agent: "support-bot" });

const verdict = kz.inspect({ tool: "export_file", publisher: "external", target: "45.9.148.108" });
if (verdict.decision === "block") throw new Error(verdict.reason);

kz.enforce(action) throws KaizenBlocked instead of returning the verdict.

Vercel AI SDK

Wrap your tools so every call is inspected. A blocked call returns a refusal to the model instead of running.

import { generateText } from "ai";
import { Kaizen } from "kaizen-security";
import { guardTools } from "kaizen-security/vercel";

const kz = new Kaizen({ apiKey: "kz_live_...", agent: "support-bot" });

await generateText({
  model,
  tools: guardTools(kz, tools),
  prompt: "...",
});

Send verdicts to your telemetry

Pass an onVerdict callback to fan every verdict into your own tracing or logging.

const kz = new Kaizen({ apiKey: "kz_live_...", onVerdict: (v, a) => log(v, a) });

Define policy in code

const kz = new Kaizen({
  policies: [{ mode: "blocklist", rules: { skill_patterns: ["delete_.*"], ip: ["45.9.148.0/24"] } }],
});

Modes are blocklist, allowlist, and correlation.