KavachOS uses Drizzle ORM under the hood. You pick a provider and pass the connection URL; KavachOS handles the rest.Documentation Index
Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
Use this file to discover all available pages before exploring further.
Choosing a provider
| Provider | Best for |
|---|---|
| SQLite | Local dev, single-server deploys, serverless edge (with Turso) |
| Postgres | Production, high-concurrency, multi-tenant |
| MySQL | Existing MySQL infrastructure |
Setup
- SQLite
- Postgres
- MySQL
SQLite is the default for development. No peer dependencies beyond For in-memory SQLite (tests and CI), use KavachOS enables WAL mode and foreign keys automatically:
better-sqlite3, which ships with kavachos.:memory: as the URL:Auto-migration
By default, KavachOS callsCREATE TABLE IF NOT EXISTS for all its tables on startup. This means your database is always ready to use without any manual migration step.
To disable this (e.g. when you manage migrations externally with Flyway, Liquibase, or drizzle-kit push), set skipMigrations: true:
Schema overview
KavachOS creates the following tables in your database:| Table | Purpose |
|---|---|
kavach_users | Human user identities, synced from your auth provider |
kavach_tenants | Multi-tenant isolation |
kavach_agents | AI agent identities (the core entity) |
kavach_permissions | Per-agent resource+action permissions with constraints |
kavach_delegation_chains | Agent-to-agent delegation records |
kavach_audit_logs | Immutable log of every agent action |
kavach_rate_limits | Per-agent call-rate counters |
kavach_mcp_servers | Registered MCP servers |
kavach_sessions | KavachOS-managed human user sessions |
kavach_oauth_clients | OAuth 2.1 client registrations (RFC 7591) |
kavach_oauth_access_tokens | Issued access and refresh tokens |
kavach_oauth_authorization_codes | Short-lived PKCE authorization codes |
kavach_agent_cards | A2A capability discovery cards |
kavach_approval_requests | CIBA async approval flow records |
kavach_trust_scores | Graduated autonomy trust scores per agent |
kavach_budget_policies | Token and call budget caps per agent/user/tenant |
snake_case. All IDs are text (UUID or CUID2). Timestamps are stored as Unix seconds integers.
Peer dependencies
| Provider | Required package |
|---|---|
| SQLite | better-sqlite3 (bundled with core) |
| Postgres | pg |
| MySQL | mysql2 |
Testing with in-memory SQLite
Use:memory: for fast, isolated tests that need no setup or teardown:
createKavach() call with :memory: gets a completely isolated database, so tests never share state.