PerSQL

A SQL database per agent, per app, per PR.

Spin up an isolated SQLite in milliseconds. Throw it away when you're done. Pay only for queries and storage — never for the database itself.

Works with Claude, ChatGPT, Cursor, LangGraph, Mastra, and any MCP client.

agent.ts Discoverability + cost
// One DB per agent run. Free until queried.
import { PerSQL } from "@persql/sdk";

const persql = new PerSQL({ token: process.env.PERSQL_TOKEN! });
const db = persql.database("acme/orders");

// Step 1 — agent learns the schema (one round-trip).
const schema = await db.describe();

// Step 2 — runs SQL, gets cost back on every response.
const { data, meta } = await db.query<{ id: number; email: string }>(
  "SELECT id, email FROM customers WHERE id = ?", [42]
);
console.log(meta?.costUsd); // self-throttle on the way out
handoff.ts Multi-agent
// Sub-agent delegation — single-use, scoped, expires.
const { token } = await db.branches.pin("pr-42", {
  role: "write",
  ttlSec: 900,                  // 15 min
});

// Hand to a sub-agent — it never sees the parent token.
const sub = await PerSQL.fromHandoff(token);
const subDb = sub.database(sub.handedOff.namespaceSlug, sub.handedOff.databaseSlug);
await subDb.query("INSERT INTO leads (email) VALUES (?)", ["a@b.co"]);

One isolation boundary, three shapes

The same primitive — a real database, free until you use it — fits an agent run, a microservice, or a PR preview.

Per agent

A fresh DB — or a branch off prod — for every Claude/GPT/Cursor task. Hand off with a scoped, single-use token; throw it away when the run ends.

Per app

Microservices, prototypes, internal tools — each gets its own database instead of crowding into one Postgres. Isolation is the default, not the upgrade.

Per PR

PUT /branches/:ref is idempotent — call it on every push. Preview environments get a real database; expiresAt cleans them up automatically.

Shaped right for the way modern code is written

Snapshots before destructive ops, cost on every response, schema search built in. The features that make autonomous and ephemeral SQL safe — included, not gated.

Cost on every response

/v1/query and /v1/batch return meta.costUsd. Your client decides when to stop — no polling a usage endpoint mid-loop.

Auto-snapshot before destructive ops

DROP, TRUNCATE, REPLACE, unbounded DELETE — automatically labeled into the 30-day PITR history. Restore is one call.

Schema discoverability

describe() returns the whole graph + docs in one call. search() finds tables by intent. doctor() lints for LLM-hostile patterns.

MCP server included

Plug PerSQL into Claude Desktop, Cursor, or any MCP client. ~40 tools covering query, schema, branches, snapshots, endpoints.

Drop-in for Drizzle / Kysely

db.driver() returns the sqlite-proxy callback Drizzle expects. persql-codegen emits a typed Drizzle schema from a live DB.

Edge-native

Each database is a Cloudflare Durable Object — embedded SQLite, migrates to the caller, sub-5ms reads from the right region.

From SQL to AI agents in one stack

Reach for the surface that fits the task: a web console for humans, an SDK for your app, a CLI for your terminal, an MCP server for your agent, public HTTP endpoints for everyone else.

Console SDK CLI MCP REST Endpoints

Pricing — only what you use

Two meters. No seat fees, no per-database fees, no plan-tier feature gates. Spawn as many databases and branches as you want — they cost nothing until they actually run queries or store data.

Per query

Every read or write across /v1 and the SDK is metered identically, regardless of which database or branch it hits.

Per stored GB

Storage rolls up across all your databases and branches. An empty branch costs nothing.

Everything else: $0

Branches, forks, snapshots, vectors, blobs, custom domains, MCP, public endpoints — all included. Plan tiers only change rate-limit headroom and support level.