kavachOS

Introduction

KavachOS is an auth OS for AI agents. It handles identity, permissions, delegation, and audit for agentic systems.

KavachOS is a TypeScript SDK that gives AI agents their own identity, enforces permissions at call time, and logs every decision. It plugs into your existing auth provider (Clerk, Auth.js, better-auth) and handles everything after the human is authenticated.

lib/kavach.ts
import { createKavach } from 'kavachos';

const kavach = await createKavach({
  database: { provider: 'sqlite', url: 'kavach.db' },
});

const agent = await kavach.agent.create({
  ownerId: user.id,
  name: 'code-reviewer',
  type: 'autonomous',
  permissions: [{ resource: 'mcp:github:*', actions: ['read'] }],
});

const result = await kavach.authorize(agent.id, {
  action: 'read',
  resource: 'mcp:github:repos',
});
// { allowed: true, auditId: '550e8400-...' }

What it does

How it fits

┌────────────────────────────────────────────────────┐
│  Your application                                  │
│                                                    │
│  ┌──────────────┐       ┌───────────────────────┐  │
│  │ Human auth   │       │ KavachOS              │  │
│  │              │──────>│                       │  │
│  │ Clerk,       │ user  │  kavach.agent.create() │  │
│  │ Auth.js,     │  ID   │  kavach.authorize()    │  │
│  │ better-auth  │       │  kavach.delegate()     │  │
│  └──────────────┘       │  kavach.audit.query()  │  │
│                         └───────────┬───────────┘  │
│                                     │              │
│                            allowed / denied        │
│                                     │              │
│                         ┌───────────▼───────────┐  │
│                         │ MCP servers, APIs,    │  │
│                         │ tools, databases      │  │
│                         └───────────────────────┘  │
└────────────────────────────────────────────────────┘

Your auth provider handles human login. KavachOS takes the user ID and manages their agents. When an agent wants to act, your code calls authorize(). KavachOS returns { allowed, reason, auditId }.

KavachOS does not replace your human auth. It does not handle login, sessions, or OAuth social providers. It starts where human auth ends.

The problem

81% deploying agents

But only 14% have security approval for those deployments.

45% use shared API keys

No per-agent identity, no scoped permissions, no audit trail.

88% had incidents

Security incidents from uncontrolled agent access in 2025-2026.

Three things break without agent-specific auth:

  • No identity. Shared API keys make every agent indistinguishable. You cannot trace an action back to a specific agent.
  • No least privilege. Broad access with no enforcement is not a security model.
  • No accountability. Console logs are not an audit trail. Compliance requires structured, immutable records.

Quick comparison

KavachOSbetter-authDIY
Agent-first data modelYesNo (plugin)You build it
Wildcard permissionsYesNoYou build it
Delegation chainsYesNoRarely done
MCP OAuth 2.1YesNoMonths of spec work
Audit log with exportYesPartialYou build it
Token rotationYesNoYou build it
Framework adapters7ManyYou build each

Get started

On this page