0.5.0-beta.1One SQL API plus live subscriptions

Give AI agents one SQL tool to your app data

Stop building custom REST or GraphQL CRUD just so agents can use product data. KalamDB gives agents and frontends the same backend directly: SQL over HTTP for reads and writes, live rows over WebSocket for subscriptions, and USER tables plus EXECUTE AS '<user_id>'for policy-scoped access.

curl -fsSL https://kalamdb.org/install.sh | bash
KalamDB — Sample Code
live-queries.tsxTSX
import { KalamProvider, LiveQueries } from '@kalamdb/react';import { asc, desc, eq } from 'drizzle-orm';import { getExampleClient } from './client';import { conversations, messages } from './schema.generated'; const client = getExampleClient(); export function InboxPane({ conversationId }: { conversationId: string }) {  return (    <KalamProvider client={client}>      <LiveQueries        queries={{          conversations: {            table: conversations,            orderBy: (table) => desc(table.updatedAt),            limit: 20,          },          messages: {            table: messages,            where: (table) => eq(table.conversationId, conversationId),            orderBy: (table) => asc(table.createdAt),            deps: [conversationId],          },        }}        deps={[conversationId]}      >        {({ conversations, messages, state }) => (          <ChatLayout            conversations={conversations.rows}            messages={messages.rows}            busy={state.loading}          />        )}      </LiveQueries>    </KalamProvider>  );}

KalamDB Architecture

See how frontend queries, PostgreSQL workflows, and live updates flow through the KalamDB runtime.

Remote modePostgreSQL + pg_kalam

PostgreSQL connects to a running KalamDB server through pg_kalam.

PostgreSQL keeps SQL parsing, planning, and the local relation surface. The pg_kalam extension reads the foreign server definition, mirrors CREATE TABLE ... USING kalamdb, and forwards scans and DML to KalamDB.

1

PostgreSQL parses and plans the query against the local table surface.

2

pg_kalam resolves the foreign server settings and tenant session context.

3

Mirrored DDL, reads, and writes are forwarded to the KalamDB server.

4

Rows come back as PostgreSQL tuples while KalamDB stays the source of truth.

See the PostgreSQL extension architecture docs for the full remote-mode flow.

postgresqlSQL
CREATE EXTENSION pg_kalam; CREATE SERVER kalam_server  FOREIGN DATA WRAPPER pg_kalam  OPTIONS (    host '127.0.0.1',    port '2910'  ); CREATE TABLE app.messages (  id BIGINT PRIMARY KEY DEFAULT SNOWFLAKE_ID(),  room TEXT,  content TEXT) USING kalamdb;

Core pillars for AI agents and chat apps

Keep each user or tenant in their own data space. Query USER tables directly, stream materialized rows in realtime, use topics for pub/sub, and move old history to object storage when you need to scale.

Live

Per-tenant isolation — no app-side filters

Every user gets a private tenant partition. The same SQL can run for every account, and USER tables still return only that caller's rows. No app-side WHERE user_id = ? glue.

See multi-tenant docs
Live / Planned

Topics + Pub/Sub streams

Publish events to topics and subscribe from any client or agent. Replay events and use consumer groups when you need them.

See topic pub/sub docs
Live

Live queries with materialized rows

Use live() to stream the current row set for messages, memory, dashboards, and tool logs without writing your own diff reconciler.

See live query docs
Live

Bring your own storage

Store old history in S3, Azure Blob, GCS, or local disk. Keep hot data fast and move cold data to cheaper storage.

See storage tiers docs
Live

Scales by user + efficient cold storage

Isolation creates natural shards per user. Older history can compact into compressed files in object storage for lower cost and faster scans.

See cold storage guide
Live

High availability clustering (Raft)

Run a Raft cluster with leader election and failover, so chat and subscriptions stay online.

See clustering docs
Live

Fast and steady performance

Low-latency writes and steady throughput for chat and high-volume agent events. Built in Rust.

See benchmark docs
Planned

End-to-end encryption (client-side)

Encrypt agent memory before it leaves your app. KalamDB stores only encrypted data. The server never sees plaintext. You hold the keys.

See security guide
Live

Admin UI: SQL Studio, Live Data and more

Web Admin UI for instances, users, and streams. Run SQL in SQL Studio, turn on Live query, browse topics, and explore per-user namespaces.

See Admin UI docs
Live

CLI tool (kalam)

Postgres-style CLI for local and cloud instances. Connect, query, subscribe, export data, and manage users from one binary.

See CLI docs

Built on proven systems

Familiar SQL for storage, subscriptions, and handoffs

No custom language to learn. Write standard SQL to create tables, save state, and subscribe to live updates. Keep hot data on local disk and store long-term history in object storage.

kalamdb — SQL Console
schema.sqlSQL
CREATE TABLE agent.messages (  id       BIGINT DEFAULT SNOWFLAKE_ID(),  role     TEXT,  content  TEXT,  user_id  TEXT,  created  TIMESTAMP) WITH (TYPE='USER');

Live state timeline

Agent writes can enter through PostgreSQL with pg_kalam, land in KalamDB, and fan back out to live subscribers in realtime.

Agent Writes to PostgreSQL

An agent or backend worker writes memory, tool output, or chat state into PostgreSQL.

pg_kalam Forwards

The pg_kalam extension resolves the foreign server and forwards that write into KalamDB.

KalamDB Commits State

KalamDB becomes the source of truth, keeping recent rows hot and moving older history to lower-cost storage when needed.

Subscribers Receive Live Rows

Materialized query updates stream over WebSocket to matching apps, dashboards, and agents.

Agents Resume from Latest State

The next agent step reads the newest committed row set and continues from the same shared state loop.

Each user scope supports files, vectors, tables, and indexes

KalamDB is more than chat messages. Inside each user space, store tables, vectors, and file records so your agents can find what they need fast.

Files

Store file metadata, ownership, and processing status in user tables.

Vectors

Store embeddings in SQL tables and rank similar rows with vector search.

Tables

Model messages, tool calls, checkpoints, and your app data as SQL tables.

Indexes

Add indexes for fast lookups as your agent workload grows.

Built for secure, multi-tenant agent workloads

AI Chat History

Per-user chat threads with materialized live rows, resume checkpoints, and full history replay.

Agent Memory & Tool Events

Store tool calls, checkpoints, and agent state in durable per-tenant tables.

Semantic Retrieval & RAG

Store embeddings alongside documents and files, then find the nearest rows with SQL vector search.

Human-in-the-Loop Workflows

Agents pause for approval, humans respond, and agents resume. Every step is saved in a private per-user history.

Realtime Dashboards

Live metrics, monitoring feeds, and notification streams with row-materialized SQL subscriptions.

Multi-tenant SaaS isolation

Ship one codebase for every customer. USER tables keep each tenant in its own partition, so the same query only returns that tenant's data.

Collaboration Feeds

Shared docs, boards, and multiplayer state with instant sync.

Every tool you need, out of the box

KalamDB includes a web Admin UI and an interactive CLI. Explore data, run SQL, subscribe to live streams, and manage users without extra tools.

🧭

Admin UI — SQL Studio & Live Data

Live

A web admin console that ships with every instance. Browse namespaces, inspect tables, and run SQL in the built-in SQL Studio. Turn on Live query to make anySELECT stream updates as rows change. Explore topics and per-user data without writing app code.

Open Admin UI guide →
⌨️

CLI — Interactive Database Terminal

Live

A Postgres-style terminal for local and cloud instances. Connect, query, subscribe, export user data, and manage users from one binary. It includes history, \info, and tab-completion. Great for scripts and CI.

Open CLI guide →

Give every user private data. Let your agents use it.

One SQL-first realtime database for user isolation, agent collaboration, and live subscriptions. Start building in minutes.