Quick Start
Evaluate a policy and log an audit event in under five minutes.
1. Get an API key
Create an API key in Dashboard → API Keys. Keys use the kc_live_ or kc_test_ prefix and are shown only once. Store the key in an environment variable.
2. Install the SDK
bash
npm install @korclaw/sdk3. Evaluate a policy
Policy evaluation
import { KorClaw } from "@korclaw/sdk";
const korclaw = new KorClaw(process.env.KORCLAW_API_KEY!);
const result = await korclaw.policies.evaluate({
input: {
action: "read_file",
resource: "customer-data.csv",
agent: "research-agent",
environment: "production",
},
});
console.log(result.allowed, result.result);Policy evaluation always writes an audit log. Blocked and approval_required outcomes return HTTP 200 with allowed: false — they are policy decisions, not errors.
4. List audit logs
bash
curl "https://app.korclaw.com/api/v1/audit-logs?limit=10" \
-H "Authorization: Bearer $KORCLAW_API_KEY"