SafeAgentDB
Safe SQL writes for AI agents. Open source, on PyPI.
A Python library that runs an AI agent's SQL in a tenant-scoped in-memory sandbox, validates and diffs the changes, then applies them to production in one atomic transaction with compare-and-swap conflict detection.
432 automated tests, CI on Python 3.10 to 3.12 and PostgreSQL 16
- Two-arm benchmark: 68 tasks, Claude agents, an independent auditor, and replay, uninformed and informed conditions.
- On v0.3.1 it prevented every in-scope unsafe write that reached it, with zero false positives.
- The benchmark exposed a key-collision bug that blocked valid inserts (9/99 safe tasks); fixed and verified in v0.3.1 (0/102).
- Python
- SQLAlchemy
- Pydantic
- PostgreSQL
- SQLite
- pytest
- GitHub Actions