What an agent sees

-- what may I touch? derived from the live catalog and MY privileges
SELECT agent_gate.discover('customers');

-- propose one statement: nothing runs
SELECT agent_gate.propose(
  'update customers set plan = ''pro'' where id = $1::int',
  'upgrade the customer who asked for it',
  ARRAY['1']);
--  {"proposal": 42, "ok": true, "kind": "write", "estimated_rows": 1,
--   "checks": [{"check": "parses",           "passed": true, ...},
--              {"check": "single_statement", "passed": true, ...},
--              {"check": "kind_allowed",     "passed": true, ...},
--              ... no_writing_cte, keeps_its_context, no_amplification, no_opaque_function ...
--              {"check": "resolves",         "passed": true,
--               "detail": "the planner resolved every table, column, type and function without executing ..."}]}

-- see the exact effect, then nothing is kept
SELECT agent_gate.dry_run(42);
--  {"outcome": "rolled_back", "rows_affected": 1,
--   "rows": [{"before": {"id": 1, "plan": "free"}, "after": {"id": 1, "plan": "pro"}}]}

-- make it real, if every guard still agrees
SELECT agent_gate.commit(42);
--  {"outcome": "kept", "rows_affected": 1, ...}

Anything else, from that session:

=> delete from customers where id > 0;
ERROR:  pg_agent_gate: this session belongs to agent "billing": it proposes, it does not execute
DETAIL:  DELETE does not reach the database from an agent session
HINT:  Call agent_gate.propose(sql, intent), then agent_gate.dry_run(proposal) or agent_gate.commit(proposal) -- or agent_gate.propose_and_commit(sql, intent) for both in one call.

The seven verbs

verb does
discover(filter, max_objects) tables, views and functions the agent has privileges on, with columns, types, keys, constraints and comments. Objects owned by extensions are left out. Includes a fingerprint, so a client can tell the schema changed
propose(sql, intent, params) verifies one statement and records it. Runs nothing – except an allow_ddl agent’s DDL, which is verified by running it in a subtransaction that is rolled back
dry_run(proposal) runs it inside a subtransaction and rolls it back: rows touched, before/after of every row of a write, whether bound assertions would still hold
commit(proposal) verifies again, runs it and keeps it if every guard agrees. A proposal is committed at most once
propose_and_commit(sql, intent, params) propose then commit in ONE call, so in one transaction: the same checks (verified at propose and again at execution), the same record, one commit instead of two. No dry_run in between – for a statement whose effect the agent has already seen, or a read. Returns {outcome, proposal, commit}; a statement that does not verify never reaches execution (refused_at_propose, commit null)
acts(max_acts) what this agent proposed and did, with every execution and why anything was refused
whoami() which agent this session is, whether the gate is enforced in it, and how durable attempts are