Skip to content

GapDB: coordinating agents without a database universe

If you've ever built an agent system with several concurrent agents and SQLite, you've probably run into the class of problems GapDB is meant to solve.
When you’re building agentic apps, a simple datastore isn’t enough. Agents also need somewhere to coordinate.

One agent claims a task. Another reviews it. Another changes its state. Agents restart, retry, disappear, come back later, and sometimes act on information that's already stale.
At that point, the database needs to be capable of storing both state and authority.

Who owns this task? Has this record changed since I read it? Am I still allowed to update it? Did that write actually become durable? What changed while I was gone?

That's why I started building GapDB.

Robert Douglass at Spec Kitty was kind enough to adopt the project, so this one does qualify as an official Spec Kitty release. 

https://github.com/spec-kitty/gapdb

A small coordination API

GapDB is a small, agent-native local datastore built around the coordination primitives agent systems actually need.

Its API is deliberately tiny: Get, Put, PutIfAbsent, CompareAndSwap, DeleteIfRevision, AtomicBatch, ScanPrefix, and Watch.

There is no SQL, no joins, no query planner, and it is making no plans to become a general-purpose database.

State, revisions and durability

Every successful commit gets a revision. So an agent can effectively say:
"Make this change, but only if the world is still the world I observed."

If another agent changed the record in the meantime, the stale operation fails.
Durability is explicit too. A write can be acknowledged as memory or durable, depending on whether the state is disposable or represents something important like a lease, review decision, or workflow authority.

A deliberately small architecture

Internally, GapDB stays intentionally simple: one owner process, an in-memory authoritative map, a single serialized writer, an append-only WAL, checksummed snapshots, and Unix-domain sockets.

The goal isn't to replace SQLite everywhere.

Rather, I built it to provide a small, flexible coordination layer for the increasingly common case where multiple autonomous agents are sharing local state and need enough structure to avoid stepping on each other's paws.

There's room to breathe, without importing an entire database universe to solve a relatively focused problem.

That's GapDB.

Yours to use, play with, and tear apart. It’s released under a permissive MIT license.

Now go my children, build something cool, and show me what you made with it!