v0.1.0Default-deny execution gate for AI agents, APIs & tools.

Every action, cryptographically unbypassable.

Kavach wraps every tool call, API hit, and agent action in a chain of evaluators: identity, policy, drift, invariants. The only way to run the action is to hold a Guarded<A> proof object. No proof, no execution.

$pip install kavach-sdk
ML-DSA-65 · ML-KEM-768Python SDK today · Node & Rust soonElastic License 2.0
chain · gate.evaluate()live
tool_callsend_emailidentitypolicydriftinvariantsGuarded<A>
idle · awaiting actionpending
how it works

A firewall for code paths that must not be bypassed.

Kavach sits between your caller and the side-effecting action. Every evaluator must approve. The verdict is signed into a tamper-evident chain. No check, no Guarded<A>, no execution.

01

Declare an action

Wrap any side-effecting function: tool call, HTTP handler, webhook, MCP invocation. It becomes unrunnable without a proof.

02

Pass through the chain

Identity, policy, drift, and invariants evaluate in sequence. Any refusal halts the chain. No silent bypass path exists.

03

Receive a signed proof

Only on unanimous approval do you get Guarded<A>: a type-safe, cryptographically signed permit token.

04

Execute & audit

Run the action. Every verdict is appended to a signed audit chain. Splice a line, verification fails, everywhere.

capabilities

What makes Kavach different.

Not another middleware stack. A type system and a crypto protocol, conspiring to make bypass structurally impossible.

01

Default-deny by construction

The only way to hold a Guarded<A> is to pass the gate. Enforced by the type system: no convention to remember.

✗ fn run(a: Action)
✓ fn run(a: Guarded<A>)
02

Post-quantum by default

ML-DSA-65 signatures and ML-KEM-768 key exchange, wired in from day one. Hybrid mode available for transition.

SIGML-DSA-65
KEMML-KEM-768
AEADChaCha20-Poly1305
03

Drift detection

Device fingerprint, geo, session age, action count. Catch compromised sessions mid-stream, not just at login.

04

Tamper-evident audit

A signed chain, not a mutable log. Every verdict signs the predecessor's hash. Splice a line, verification fails.

8a3f
9c12
af04
05

Hot-reload policy

Write rules in TOML, JSON, or dict literals. Edit the file, the watcher picks it up in-flight, no redeploy.

# policy.toml
[rule.block_admin]
deny_if = "!role:admin"
06

Distributed invalidation

Redis-backed broadcast. One replica revokes a session, every other node in the cluster knows within milliseconds.

r0
r1
r2
r3
r4
drop in

Wrap an action. Watch the gate do its job.

Declare the action, evaluate through the chain, unwrap the Guarded<A>, execute. Python SDK is available today; Node and Rust SDKs are built and under internal testing.

default-deny · signed permit · PQ
# Wrap an action. Only a signed, fully-evaluated
# proof can unlock execution.

from kavach import Gate, Action, Guarded

gate = Gate.from_config("./policy.toml")

@gate.action("send_email")
def send_email(to: str, body: str) -> None:
    smtp.send(to, body)

# evaluate through identity → policy → drift → invariants
proof: Guarded[SendEmail] = gate.evaluate(
    action=SendEmail(to="ceo@acme.com", body="..."),
    principal=current_user(),
    context=request_ctx(),
)

# only way to actually run it
send_email.unwrap(proof)
post-quantum by default

Crypto built for the decade after this one.

NIST's post-quantum primitives, wired in from day one. Your permit tokens, sealed channels, and signed audit chains are safe against adversaries that don't exist yet, and ready for the ones that will.

Read the post-quantum doc
Signature
ML-DSA-65
NIST FIPS 204 · lattice-based
Key Exchange
ML-KEM-768
NIST FIPS 203 · CRYSTALS-Kyber
AEAD
ChaCha20-Poly1305
Sealed channels · RFC 8439
Hybrid Mode
Ed25519 / X25519
Classical, for transition
built for

Teams who need provable, not assumed.

If your code path runs side-effects based on a model's output, a webhook body, or an admin token, Kavach is the layer between “we checked” and “we can prove we checked.”

AI agent & MCP devs

Enforce policies on every tool invocation. The LLM can't route around the gate.

Backend engineers

Drop a verifiable authorization layer over HTTP APIs, admin endpoints, and webhooks.

Security teams

Post-quantum crypto without rolling your own. Tamper-evident audit by default.

Small infra teams

A drop-in library: not a hosted platform, not a vendor dependency, not another control plane.