Which queries are worth stopping
Not every write is dangerous, so gate precisely. The clear destructive patterns are the irreversible or wide-blast ones: DROP TABLE and DROP DATABASE, TRUNCATE, DELETE without a WHERE clause, UPDATE without a WHERE clause (the classic that rewrites every row), and schema-altering statements like ALTER and the various DDL commands. These are the queries where a mistake isn't a bad row, it's a lost table.
Scoped writes — an INSERT, an UPDATE or DELETE that targets specific rows by id — are usually routine and shouldn't be held, or your queue fills with noise and reviewers stop reading. The art is gating the shape that signals danger (the missing WHERE, the DROP, the TRUNCATE) rather than the operation type wholesale. That keeps human attention on the queries that can actually wreck the database.
Intercept the query, read the body, decide
agent·shield sits as a transparent proxy in the path between the agent and the database's HTTP-accessible endpoint. Because the SQL lives in the request body, agent·shield can inspect it: its policies are regex over method, path, and body, so a policy can match "DROP TABLE" anywhere in a query body, or an UPDATE/DELETE that lacks a WHERE clause. A match holds the query; no match forwards it instantly.
A held query is parked, not run — the database never receives it until a person approves. The reviewer sees the actual SQL, so the decision is concrete: this DELETE has a WHERE targeting one record, approve; this one would hit the whole table, deny. And because it's a proxy, there's no SDK and no change to the agent or its ORM — you point the agent's database traffic at agent·shield and the inspection happens in the middle.
Keep legitimate queries fast, and keep the record
The whole design depends on safe queries not being slowed down. Reads and scoped writes are forwarded instantly, so the agent queries at full speed for almost everything it does; only the destructive patterns pause. If you find a routine query keeps getting held, that's a signal to tighten the policy so it stops matching the safe case — the goal is a queue that only contains queries genuinely worth a human's look.
Every query decision is written to the append-only audit log: the full query, the policy it matched, who approved or denied a held one, and when. After an incident or a near-miss, you can see exactly which destructive queries the agent attempted and what was caught — which is also how you justify giving an agent database access in the first place. To be precise: the protection covers the database traffic you route through agent·shield, so point the agent's queries at the proxy and that's the surface it guards. It governs query intent; it's not a replacement for the database's own permissions.
how it works
- 01
Define the destructive query patterns
Gate DROP TABLE / DROP DATABASE, TRUNCATE, DELETE and UPDATE without a WHERE clause, and schema changes (ALTER/DDL). Leave scoped, id-targeted writes to forward.
- 02
Route the agent's database traffic through agent·shield
Point the agent's database connection at the proxy. No SDK and no ORM changes — the agent issues queries as before, and agent·shield sees the bodies.
- 03
Write body-matching policies
Use regex over the query body to match the destructive patterns. A match holds the query; no match forwards it instantly to the database.
- 04
Review held queries
Read the actual SQL in the queue and approve (it's forwarded) or deny (it never reaches the database). The query stays paused until you decide.
- 05
Tune from the audit log
Every query decision is recorded. Relax policies that keep holding safe queries and keep the gate tight on the genuinely destructive shapes.
frequently asked
- Can agent·shield tell a dangerous query from a safe one?
- It matches the patterns you define against the query body — DROP TABLE, TRUNCATE, DELETE or UPDATE with no WHERE, schema changes. Those shapes signal danger reliably; scoped, id-targeted writes don't match and are forwarded. You tune the policies to your schema so the gate catches the destructive cases without snagging routine ones.
- Won't inspecting every query slow my agent down?
- Only the destructive ones are held. Reads and scoped writes are forwarded instantly, so the agent queries at full speed for the vast majority of its work. If a routine query keeps getting held, you tighten the policy so it stops matching the safe case.
- Do I have to change my agent's ORM or database code?
- No. agent·shield is a transparent proxy — you point the agent's database traffic at it and the agent issues queries exactly as before. There's no SDK and no ORM rewrite; the inspection happens in the middle of the connection.
- Is this a replacement for database permissions?
- No — it's a complement. Database permissions decide what the agent's role is allowed to do; agent·shield decides, per query, whether a permitted-but-destructive statement should run now or wait for a human. Use both: least-privilege roles, plus a hold on the dangerous queries that remain possible.
Published June 4, 2026 · Last updated June 13, 2026