See What Your Agent Did · Singapore · 26 Nov 2026
chDB

Giving Your AI Agent
a Database Brain

recall it in one SQL · keep it in your bucket · connect it to live data
Auxten Wang · ClickHouse · Creator of chDB@auxten
ABOUT
Auxten Wang

Auxten Wang

@auxten · auxten.com

Started chDB as a side project in 2023
chDB joined ClickHouse in 2024
Today: embedded ClickHouse — Python, browser, agents
chDB
ClickHouse
THE PROBLEM

A million users need a million brains

Every organization and every user expects the agent to remember them, and only them.

ISOLATED

My memory must never show up in your prompt.

CHEAP WHEN IDLE

Most brains are asleep most of the day.

SEARCHABLE

By meaning, by exact word, by time, by status.

PORTABLE

Laptop, sandbox, any cloud. Same state.
Today: a vector store + a Postgres + a log pipeline, shared by everyone.
THE PLAN

A database brain does three things

PART 1

RECALL

One SQL finds the right memories and builds the context.
vector index
inverted index
filters · ranking · budget
PART 2

KEEP

One object per org and user, in your own bucket.
S3 · R2 · MinIO · GCS · Azure
compressed · encrypted
MicroVM when awake
PART 3

CONNECT

A gateway in front, live data sources behind.
route to the right brain
join memory with live data
every step leaves a row
The live slides run ClickHouse inside this browser tab
THE ENGINE

chDB: ClickHouse inside your process

Your agent's process

agent code

———→
function call

ClickHouse engine

no server · no port · pip install chdb
4.3M
PyPI downloads
last 30 days
Apache 2.0
Python · Node · Go · Rust
browser (WASM)
NEW SINCE PYCON SINGAPORE IN JUNE
ChDBTool — a read-only SQL tool for agents 4.2 · beta
chdb.durable — the database lives in your bucket 4.4
Polars in and out 4.5
uvx chdb "SELECT 1" 4.5
PyArrow results, straight from the query 4.5.1
Same engine, same SQL as ClickHousedownloads: pypistats, 25 Nov 2026
PART 1 · RECALL

Memory is a row, not a markdown file

CREATE TABLE memory ( id UInt32, kind LowCardinality(String), status LowCardinality(String), ts Date, ref String, text String, emb Array(Float32),  INDEX meaning emb TYPE vector_similarity( 'hnsw', 'cosineDistance', 128),  INDEX words text TYPE text( tokenizer = splitByNonAlpha))ENGINE = MergeTree ORDER BY (kind, id)

COLUMNS

who, what kind, when, still true?

HNSW INDEX

find it by meaning

INVERTED INDEX

find it by the exact word
One table. Meaning, words and rules in the same query.
PART 1 · RECALL

Two indexes, one table

BY MEANING · HNSW
28.8 → 6.7 ms
nearest 10 of 500,000 vectors, recall 0.94
BY WORD · INVERTED INDEX
4.0 → 1.1 ms
one rare word in 500,000 rows
BOTH · words narrow it, meaning ranks it
SELECT text FROM memory WHERE hasAnyTokens(text, ['timeout']) ORDER BY cosineDistance(emb, q) LIMIT 3 SETTINGS vector_search_filter_strategy = 'prefilter'
1 For a courier timeout, check the region queue first, then replay the webhook from the console.
2 ERR-4417 was a courier webhook timeout; the fix was to raise the client timeout to 30 seconds.
3 Open: compare courier on-time rate in Singapore before and after the timeout fix.
Recorded on native chDB 4.5.1 · MacBook M4 Protimings on synthetic data
PART 1 · RECALL

Memories arrive. Some stop being true.

WHAT HAPPENED
WHAT THE BRAIN KEEPS
6 May · MEETING“Keep the weekly spreadsheet export.”
3 Jun · CHAT“A long email on Friday, please.”
9 Sep · MEETING“Stop it. Query the files directly.”
23 Sep · TOOL LOGcourier webhook timeout · ERR-4417
12 Oct · CHAT“Three Slack bullets, Monday 9am.”
#18
decision · 2026-05-06 OLD · superseded
Team decided to keep exporting orders to spreadsheets every week.
#1
preference · 2026-06-03 OLD · superseded
Mei wants weekly status updates as a long email on Friday afternoon.
#19
decision · 2026-09-09 replaces #18
Team decided to stop the weekly spreadsheet export and query the Parquet files directly.
#24
incident · 2026-09-23
ERR-4417 was a courier webhook timeout; the fix was to raise the client timeout to 30 seconds.
#2
preference · 2026-10-12 replaces #1
Mei now prefers status updates as three bullets in Slack, posted before 9am on Monday.
Nothing is deleted. The old row stays as history; recall reads status = 'active'.
LIVE · IN THIS TAB

Meaning finds the topic. Words find the fact.

BY MEANING · cosineDistance, no filter
distmemory
0.286ERR-4147 was a duplicate payment callback and was closed without a code change.
0.317ERR-4417 was a courier webhook timeout; the fix was to raise the client timeout to 30 seconds.
0.348Payment retries doubled on 10 November after the bank changed its 3DS page.
0.354ERR-4471 was an expired signing certificate on the returns portal.
BY WORD · hasAnyTokens [4417]
hitsmemory
1ERR-4417 was a courier webhook timeout; the fix was to raise the client timeout to 30 seconds.
BOTH + RULES · status = 'active', rank fusion
kinddatememory
incident2026-09-23ERR-4417 was a courier webhook timeout; the fix was to raise the client timeout to 30 seconds.
incident2026-08-30ERR-4147 was a duplicate payment callback and was closed without a code change.
incident2026-11-10Payment retries doubled on 10 November after the bank changed its 3DS page.
recordedwaiting for the engine…
LIVE · IN THIS TAB

One SQL in. Prompt-ready context out.

WHAT THE MODEL GETS
[task 2026-11-18] Open: draft the Vietnam launch readout for Priya by Friday 27 November.
[procedure 2026-07-08] Before sending numbers to Priya, reconcile them with the finance extract.
[decision 2026-10-20] From November the Vietnam launch budget is tracked separately from Singapore.
[fact 2026-02-14] Mei's manager is Priya, and Priya reads only the first paragraph.
[fact 2026-10-01] Mei owns the Vietnam market since October.
[procedure 2026-08-12] To answer a late delivery question, look up the promised date, the carrier scan and the customer tier.
recordedwaiting for the engine…
PART 2 · KEEP

One object per user, in a bucket you own

COMPUTE · appears when needed

acme / mei

agent + chDB

acme / arun

agent + chDB

globex / li

agent + chDB
↕ flush · checkpoint · open
STATE · your object storage
s3://brains/acme/mei/ head.json who holds the lease wal/… statements since the base checkpoints/… compressed full backup s3://brains/acme/arun/… s3://brains/globex/li/…
Durable ObjectschDB durable
Identitynamed objectnamed object
Writerone, single-threadedone, lease + compare-and-swap
EngineSQLiteClickHouse MergeTree
State liveson CloudflareS3 · R2 · MinIO · GCS · Azure
ComputeWorkersany process, any cloud
Routingbuilt inyou bring it → part 3
Sourceplatformopen source
Same idea as Durable Objects. Open source, analytical, and you own every byte.
PART 2 · KEEP

Say “I'll remember” only after flush()

from chdb import durable org = durable.Namespace("s3://brains/acme", owner="vm-A") brain = org.open("mei") # lease + restore brain.execute("INSERT INTO memory VALUES (…)") # local, fast, not safe yet brain.flush() # now it survives this VM brain.checkpoint() # fold the log into a base brain.close() # release the lease

A SECOND WRITER

LeaseHeld: object 'mei' is held by 'vm-A'

ANOTHER MACHINE, LATER

org.open("mei") → same rows,
HNSW and inverted index still in the plan

READERS

read_only=True · no lease needed

One writer is the point: a personal brain has one owner. The log replays SQL, so write literal values, not now().

chdb.durable, chDB 4.4+ · pip install "chdb[durable]"outputs recorded on 4.5.1, local S3-compatible endpoint
PART 2 · KEEP

Compressed, then encrypted, by the engine

CREATE TABLE evidence (…, text String CODEC(ZSTD)) ENGINE = MergeTree ORDER BY (kind, id) SETTINGS disk = disk( type = encrypted, algorithm = 'AES_128_CTR', key = '<org key>', disk = disk(type = s3_plain_rewritable, endpoint = 'https://…/evidence/acme/mei/'))

IN THE BUCKET, PLAIN

…SECRETMEMO E849E8BB6F…

IN THE BUCKET, ENCRYPTED

454e 4302 0000 0095 1e89 8a69…
2M rowsplainAES
raw → on disk384 MB → 89 MB
extra size–64 B per file
recall-size read2–4 ms4–5 ms
one-org scan8–9 ms12–13 ms
full text scan~40 ms~64 ms
write + merge3.8 s4.5 s
One key per org. With the wrong key the table does not open: DATA_ENCRYPTION_ERROR.
This is a table on an encrypted S3 disk, not a durable object. Durable objects are stored as written: use SSE-KMS.
chDB 4.5.1 · M4 Pro · timings on local SSD, warm cache, synthetic textS3 latency not included
PART 2 · KEEP

Rent the body. Keep the memory.

1 · WAKE

MicroVM starts from a warm snapshot

2 · OPEN

restore this user's object

3 · THINK

recall and query in-process

4 · FLUSH

state is safe in the bucket

5 · GONE

terminate. 8 h max anyway
$0.0023
per month, an idle 100 MB brain (S3 only)
$0.13
per awake hour, 1 vCPU / 2 GB

One active user, one month

awake 20 sessions × 10 min $0.42 launch 20 × 2 GB snapshot read $0.06 S3 100 MB + 400 PUTs $0.004 total ≈ $0.49 10,000 users, 5% active ≈ $265
A model, not a bill · AWS price list, us-east-1, ARM, published 20–21 Nov 2026reference design · LLM calls not included
PART 3 · CONNECT · REFERENCE DESIGN

Put a gateway in front: one brain, many senses

Agents

chat · Slack · cron · MCP

GATEWAY

who is asking?
→ org / user id
wake that VM
scoped creds
limits · log
YOU BRING THIS

MicroVM

agent + chDB
one user only
memory = local
one writer

Postgres

orgs · users · ACL

Your bucket

brains/acme/mei/

Files & lakes

s3() · iceberg() · file()

Databases

postgresql() · mysql() · mongodb()

APIs & web

url()

ClickHouse Cloud

remoteSecure()
Isolation is layers: own bucket prefix + IAM, own VM, own key. Not a WHERE clause.
LIVE · IN THIS TAB

Memory knows the question. The source knows today.

“How are my markets doing on late deliveries?” — memory knows which markets, and how “late” is counted.

marketfrom_memoryorderslatelate_pct
VNMei owns the Vietnam market since October.118415813.3
SGMei owns the Singapore market since October.16921207.1
recordedwaiting for the engine…

Indonesia is missing on purpose: Mei owned it until September, so that row is superseded.

PART 3 · CONNECT

The tool you hand to the model

from chdb.agents import ChDBTool tool = ChDBTool( max_rows=3, file_allowlist=["./brain/"], ) specs = tool.tool_specs("anthropic") tool.call("run_select_query", {"sql": sql})
the model triesthe model reads back
CREATE TABLE x …READONLY
Cannot execute query in readonly mode
file('/etc/passwd')ALLOWLIST_DENIED
source path not in file_allowlist
SELECT txt …UNKNOWN_IDENTIFIER
Maybe you meant: ['text']
too many rowstruncated: true
aggregate or filter instead of re-running

Read-only is not a sandbox. It guards against mistakes, not adversaries. The sandbox is the VM. An engine-level local-file restriction is coming; it is not in a release yet.

Errors go back to the model as data, so it can fix its own SQLbeta · outputs recorded on 4.5.1
LIVE · IN THIS TAB

Traces are rows too: what did this talk recall?

kindmemory_usedtimessteps
procedureBefore sending numbers to Priya, reconcile them with the finance extract.1context
incidentERR-4147 was a duplicate payment callback and was closed without a code change.1hybrid
incidentERR-4417 was a courier webhook timeout; the fix was to raise the client timeout to 30 seconds.1hybrid
decisionFrom November the Vietnam launch budget is tracked separately from Singapore.1context
factMei owns the Vietnam market since October.1context
recordedwaiting for the engine…
Langfuse keeps its traces in ClickHouse. Same rows, same SQL → next talk.
HONESTY

Where this stops

One writer per object. Great for a personal brain. A shared team memory belongs on a ClickHouse server.
Not OLTP. Frequent point updates and transactions belong in Postgres.
Durable V1 makes full checkpoints and does not clean up old ones. Keep one brain small.
Durable V1 does not encrypt. The lease coordinates writers; IAM is the security.
The gateway is yours to build. chDB gives you the object, not the router.
The browser demo is exact search. The HNSW index runs in native chDB.
TAKEAWAYS

Three things to take home

1

Recall is a query.

Meaning, words, rules and a token budget, in one SQL.

2

Give every user their own brain.

An object in your bucket. Compute only while it is thinking.

3

Memory is worth more next to live data.

Same engine, same query, and every step leaves a row.
@auxten · auxten.comNext: Ilya Verbitskiy, inside the agent with Langfuse
BACKUP

Where agent memory can live

computedurabilityanalyticswriters
SQLite in an agent frameworkin-processone local filerow storeone process
SQLite + Litestreamin-processlog streamed to object storagerow storeone process
Postgres + pgvector, managed memoryremote servicehandled by the serviceOLTP + vectorsmany
Cloudflare Durable Objectsplatformplatformapplication stateone per object
DuckDB or plain chDB on diskin-processone local diskfull columnarone process
chDB durablein-processyour object storage, explicit flushfull columnarone per object, by lease
BACKUP

Local call vs remote call

local p50
1.1 ms
local p99
2.8 ms
remote p50
63 ms
remote p99
450 ms
p99, 2% errors
2,000 ms

The network in this benchmark is simulated. Run it with your own numbers: github.com/auxten/agent-local-vs-remote