← All work

Agent2DB

A desktop database agent: connect PostgreSQL, ask in plain language, and let an agent explore the schema, write and run SQL, and remember what it learns, with a human approving every write.

October 2026ShippedSource on GitHub ↗

Agent2DB lets an LLM agent work against a real PostgreSQL database without being trusted with it.

Reads use a ranked schema index (BM25 with optional embeddings and foreign-key expansion) instead of dumping 500 table names into the prompt. Writes pause for approval, showing the parsed statement type, warnings and a planner row estimate, and run through a separate least-privilege write role. Pending approvals survive a backend restart via a LangGraph Postgres checkpointer.

Runs track tokens and cost, fall back across models, and trim history. A question benchmark runs against the live model as a CLI.

Hard parts

  • Schema retrieval that scales past hundreds of tables (BM25 + embeddings + FK expansion)
  • Human-in-the-loop writes with planner estimates, through a separate DB role
  • Durable approvals that survive restarts (LangGraph Postgres checkpointer)

More work