Interdict acts as a protective layer for AI agents interacting with Postgres databases. By simulating the impact of writes before execution and enabling safe undos, it prevents catastrophic data loss while providing detailed explanations and suggested corrections for every blocked statement. This ensures safer database operations and robust oversight.
Interdict: The Essential Safety Layer for AI-Driven Database Operations
Interdict serves as a protective safety layer between AI agents and Postgres databases, effectively mitigating the risks associated with unauthorized or erroneous write operations. With AI agents increasingly interacting with production databases, a single incorrect statement has the potential to cause substantial data loss. Traditional permission models are inadequate as they verify whether a role can modify a table but fail to assess the real impact of those modifications.
> UPDATE accounts SET balance = 0 ⛔ blocked: no WHERE — would hit every row
> UPDATE accounts SET balance = 0 WHERE id = 1 ✓ UPDATE 1 (undo id 3811adb4)
> DELETE FROM accounts WHERE balance < 2000 ⚠ held: would delete 2,300,000 rows → approve
> \undo ✓ reverted — rows restored
| Metric | Result |
|---|---|
| Cost added per statement (warm) | 2.6 µs p50 / 2.7 µs p99 |
| End-to-end overhead vs raw asyncpg | ≈ 0 ms — CI fails any build over 5 ms p99 |
| Dangerous statements missed (red corpus) | 0% of 40 |
| Safe statements wrongly blocked (green corpus) | 0% of 18 |
| Blast-radius measurement | exact row counts, live |
| Undo round-trip | ~4 ms, conflict-checked, exact restore |
| Automated tests | 343, run in CI on every commit |
Interdict’s architecture encompasses real-parallelism race tests, fault injection, and evasion attacks to ensure reliability and robustness. For detailed methodology, refer to the benchmark results.
Interdict processes queries through the following pipeline:
AI agent ──(MCP)──> [thin adapter] ──> [SAFETY ENGINE] ──> Postgres
parse → classify → policy → (simulate?) → decide
│ (record undo on writes)
async: audit log, advisory intent check
| Variable | Default | Purpose |
|---|---|---|
AGENT_DB_DSN | local dev DSN | Target Postgres. |
AGENT_POLICY | policies/default.yaml | Configurable policy definitions. |
AGENT_OPERATOR_TOKEN | unset | Token for approving held writes. Required for security. |
AGENT_APPROVAL_TTL_SECONDS | 1800 | Duration that held writes remain approvable. |
AGENT_AUDIT_LOG | ~/.interdict/audit.jsonl | Async log of actions taken with the system. |
engine/ # core functionalities: parse, classify, audit, simulate, undo
adapters/ # microservice component for communication
policies/ # user-defined policies in YAML format
corpus/ # query testing libraries (red for blocks, green for safe)
benchmarks/ # performance testing framework
tests/ # test suite for functionality validation
website/ # project landing page (interdict.vercel.app)
Interdict empowers developers and organizations to safely leverage AI in database transactions while maintaining the integrity and security of their data.
No comments yet.
Sign in to be the first to comment.