Overviews
Introduction
Kernite is a policy engine to make your APIs LLM-ready. It scans API schema, generates policies, and returns reproducible decision contracts with AI-operable reasons. Unlike other general policy engines such as Casbin/OPA/Cedar, Kernite is purpose-built for making APIs policy-enforceable and ready for programmatic remediation with AI agents.Why Kernite
- Fast-to-enforce: scan API schema, generates policies, and apply them to endpoints in 60 seconds.
- Reason by Design: decision reasons are structured for programmatic remediation, not on ly human logs.
- Contract-First:
decision,reason_codes,reasons,trace_hashare required integration surfaces. - Reproducible tracing: canonical input and policy context produce deterministic
trace_hashoutput. - Zero overhead: no runtime dependencies (
dependencies = []). - DSL not required: enforce your policy without learning a new language.
- Practical:
kernite checkfor reviewing write-mutation,observemode for collecting evidence before enforcement, and more.
When should I use this?
Use Kernite if:- Your API surface is large and you want policy coverage visibility from OpenAPI.
- You want machine-operable deny reasons for automated remediation and retry.
- You need deterministic evidence (
trace_hash) that you can persist and replay.
- You want a mature policy language ecosystem with centralized governance tooling.
- You already have an established policy pipeline and need a dedicated PDP.
Use Cases
- AI-assisted actions: gate tool calls and use
reason_codesfor automatic retry/remediation. - Internal APIs: apply one deterministic write guard across UI/API/workers.
- SaaS multi-tenant systems: enforce tenant-scoped write decisions and persist evidence.
Comparisons with other policy engines
| Topic | Kernite | Casbin/OPA/Cedar |
|---|---|---|
| Primary goal | Policy-gate APIs for AI operations and remediations (fix-and-retry with reason_codes). | Human-authored policy enforcement and policy-language tooling. |
| Decision contract | Required structured contract (decision, reason_codes, reasons, trace_hash). | Explanations exist, but the remediation contract is not standardized across integrations (codes/reasons/evidence vary by setup). |
| Reproducible evidence | Built-in deterministic evidence surface (trace_hash) plus conformance vectors for replay. | Strong policy engines; replay determinism depends on integration and policy/data pipeline discipline. |
Non-goals
- A general-purpose policy language / DSL runtime.
- Proxying or routing traffic (Kernite returns decisions; your app performs the write).
- Replacing your domain logic. Kernite decides and explains; your app enforces.
Quickstart
Install Kernite
First install kernite using UV:#1 Scan API schema
Start from your API project repo and run a Kernite scan. We’ll use this repo in this Quickstart:https://github.com/fastapi/full-stack-fastapi-template
write_operations = 17violations = 34- top remediation codes:
missing_x_kernite,missing_policy_key
#2 Generate Policy
Input format for v1 is OpenAPI JSON only. YAML files are intentionally rejected with conversion guidance to keep the core runtime dependency-free. Generate bundle + mapping + report:policy-bundle.generated.jsonpolicy-map.generated.jsonpolicy-generation-report.json
0valid coverage1coverage violations (strict)2input/parse errors
/integrations/ci-cd-policy-check.
#3 Implement Endpoint Using Generated Policy
After generation, wire your endpoint topolicy-map.generated.json + policy-bundle.generated.json.
This avoids manual policy selection per route.
#4 Observe Logs, Then Enforce
Start in observe mode:Reference Docs
- Execute request/response examples and
policy_context:/api/execute - Runtime modes (
enforce/observe/skip) and sink env vars:/integrations/observe-mode - FastAPI write guard integration:
/integrations/fastapi-guard - Production hardening and persistence notes:
/integrations/persistence - Contract invariants and compatibility guarantees:
/concepts/compatibility - Policy authoring guide (PARC model):
/concepts/how-to-write-policy
Compatibility and Conformance
- Contract policy:
/concepts/compatibility - Conformance vectors:
/conformance/execute-vectors - Reason code semantics:
/conformance/reason-codes
Performance Check
Kernite includes a dependency-free benchmark harness./concepts/performance.