Messages, agent memory, and tool logs — isolated per user, and streamed live to clients. Scales as history explodes: hot stays fast, cold moves to low-cost object storage with replay.
1-- chat.messages is a per-user table.2-- Every user sees their own isolated data automatically (no user_id column needed).3CREATETABLE chat.messages (4 id BIGINTDEFAULT SNOWFLAKE_ID(),5 thread_id TEXT,6 role TEXT,-- 'user' | 'assistant' | 'tool'7 content TEXT,8 created_at TIMESTAMP9)WITH(TYPE='USER');1011-- Topic routing and consumption12CREATE TOPIC chat.message_events PARTITIONS 2;13ALTER TOPIC chat.message_events
14ADD SOURCE chat.messages
15ONINSERT16WITH(payload ='full');1718-- User sends a message (written into their own private space)19INSERTINTO chat.messages (thread_id, role, content, created_at)20VALUES('thread_42','user','Can you check my invoice?',NOW());2122-- Agent worker consumes message events to trigger processing (e.g. tool calls/thinking/replying/streaming)23CONSUME FROM chat.message_events GROUP'chat-worker-1'FROM LATEST LIMIT50;24-- Agent writes back impersonation (same user scope; still isolated)25EXECUTEASUSER'service_bot'(26INSERTINTO chat.messages (conversation_id, role_id, content)27VALUES(1,'assistant','I processed your request')28);29ACK chat.message_events GROUP'chat-worker-1' UPTO OFFSET50;3031-- User live subscribes to new messages in a thread.32-- NOTE: No `user_id = ...` — the connection is already scoped to the user.33SUBSCRIBE TO chat.messages
34WHERE thread_id ='thread_42'35OPTIONS (last_rows =20);36
Core Pillars
Core pillars for AI chat + agent infrastructure
The default building blocks for private per-user data, topics + pub/sub, live SQL subscriptions, and agent workloads — built to handle the data explosion agents create.
🔐
Live
Per-user isolation by default
Each user gets a private data space. No user_id filters. Share only when you choose.
Web admin console for instances, users, and streams with a built-in SQL Studio, live SUBSCRIBE TO rows/events, topic browsing, replay controls (if enabled), and per-user namespace exploration.
End-to-end system architecture for query execution, storage tiers, and real-time data flow.
Code-First
Familiar SQL for storage, subscriptions, and handoffs
No custom DSL. No vendor lock-in SDK. Write standard SQL to create tables, insert state, and subscribe to live updates across local disk and object storage backends powered by Rust object_store.
kalamdb — SQL Console
CREATE TABLE agent.messages (
id BIGINT DEFAULT SNOWFLAKE_ID(),
role TEXT,
content TEXT,
user_id TEXT,
created TIMESTAMP
) WITH (TYPE='USER');
Data Flow
Live state timeline
Write state, trigger filtered subscriptions, sync users and agents instantly.
Agent Writes
Memory or tool-call state is inserted via SQL
KalamDB Persists
Hot writes in RocksDB, cold data in object storage via Rust object_store
Subscribers Notified
Filtered live updates pushed over WebSocket
Agents Resume
UI and agents continue from latest state
User Data Surface
Each user scope supports files, vectors, tables, and indexes
KalamDB is not only chat rows. Inside each user boundary, you can organize structured tables, vector-enabled records, file metadata, and indexes for fast retrieval by agents.
🗂️
Files
Store file metadata, ownership, and processing status in user-scoped tables.
🧠
Vectors
Keep embeddings with user records so agents can run semantic memory retrieval.
🧱
Tables
Model messages, tool calls, checkpoints, and domain entities as normal SQL tables.
📇
Indexes
Create indexes inside tables for low-latency lookups and scalable agent workloads.
Use Cases
Built for modern application workloads
💬
AI Chat History
Per-user thread memory with real-time message streaming and full history replay.
🤖
Agent Memory & Tool Events
Store tool calls, checkpoints, and agent state in durable per-tenant tables.
👥
Human-in-the-Loop
Agents pause for approval, humans respond, agents resume — all through shared state.
📊
Realtime Dashboards
Live metrics, monitoring feeds, and notification streams via SQL subscriptions.
🔔
App notifications
Deliver in-app notifications and alerts with SQL subscriptions and replayable history.
🔄
Collaboration Feeds
Shared docs, boards, and multiplayer state with instant sync across clients.
Tooling
Every tool you need, out of the box
KalamDB ships with a full web-based Admin UI and an interactive CLI — no third-party clients required to explore data, run queries, subscribe to live streams, or manage users.
🧭
Admin UI — SQL Studio & Live Data
Live
A web-based admin console bundled with every instance. Browse namespaces, inspect tables, and run any SQL directly in the built-in SQL Studio. Flip on Live query to turn any SELECT into a real-time subscription — rows update as data lands. Explore topics, replay consumer offsets, and drill into per-user data spaces without writing a single line of application code.
A Postgres-style interactive terminal for local and cloud instances. Connect, query, subscribe, export user data, and manage users from a single binary. Supports command history, \info for session details, and full tab-completion. Ideal for scripting, CI pipelines, and quick inspection without opening a browser.