# 1 · unpack the release tarball (early access — request a build below)
tar xzf agentdb-0.1.2-linux-x86_64.tar.gz && cd agentdb-0.1.2-linux-x86_64
# 2 · mint an API key — hashed entry lands in keys.json, plaintext prints once
KEY=$(./agentsql keygen --tenant demo --role admin --out keys.json)
# 3 · serve (durable at ./agentdb; lake/S3/PITR are env vars when you need them)
# port 8080 taken? AGENTSQL_BIND=127.0.0.1:8081 — and change 8080 below
AGENTDB_DATA_DIR=./agentdb AGENTSQL_API_KEYS=keys.json \
AGENTSQL_ADMIN_KEYS=$KEY ./agentsql-server >server.log 2>&1 &
# 4 · seed a table — two rows in
curl -s -X POST localhost:8080/sql -H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d '{"sql": "CREATE TABLE runs (id BIGINT NOT NULL, note TEXT, PRIMARY KEY (id))"}'
curl -s -X POST localhost:8080/sql -H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d "{\"sql\": \"INSERT INTO runs VALUES (1, 'first'), (2, 'second')\"}"
# 5 · now fork the whole database — no dump, no copy — and query the past
curl -s -X POST localhost:8080/admin/branch -H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' -d '{"name":"what-if","parent":"main"}'
# → {"branch":"what-if","branch_id":1,"fork_lsn":13,"parent":"main"}
# (fork_lsn counts every write, system tables included)
curl -s -X POST localhost:8080/sql -H "Authorization: Bearer $KEY" \
-H 'content-type: application/json' \
-d "{\"sql\": \"SELECT count(*) FROM runs AS OF BRANCH 'what-if'\"}"
# → {"columnTypes":["i64"],"columns":["count"],"elapsed_us":123,"rows":[[2]]}
# — a fork of your database at write 13, queryable in SQL.
# Open Studio → Branches to watch it.
# 6 · now try to LOSE data — a real kill -9, mid-commit, in your terminal
./agentsql crashtest
# → acked: 632 (commits acknowledged before SIGKILL)
# recovered: 632 (rows present after reopen + WAL replay)
# lost: 0
# RPO=0 held: every acknowledged commit survived kill -9.
# It SIGKILLs a scratch engine, not your server. Your acked count will
# differ (the jittered kill lands where it lands); lost: 0 is the
# contract, and a violation exits non-zero.Already have an agent host? Point any MCP client at /mcp and it can query, branch, and replay over the same engine — MCP-native since June 2026, destructive admin tools preview-by-default (explicit apply to execute). Existing tooling connects too: a pg-wire front-end serves psql and Grafana directly (simple protocol, token auth shared with the HTTP custody model).
Production posture in two env vars: AGENTSQL_BOUNDS_PROFILE=bounded caps what any session can SET its limits to (10-minute statement ceiling / 10⁹ scanned rows; managed = 2 min / 10⁸ for multi-tenant), and AGENTSQL_STATEMENT_TIMEOUT_MS=30000 sets the separate, composable session default. Under a ceiling, SET statement_timeout_ms = NULL resolves to the ceiling — no escape hatch — and an unknown profile name refuses to boot. Shipped unset, the Postgres convention: nothing is bounded until you opt in.