pg_agent_gate
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_agent_gate | 0.3.0 | SEC | Apache-2.0 | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 7470 | pg_agent_gate | No | Yes | Yes | Yes | No | No | agent_gate |
| Related | pg_living_assertions pg_policy |
|---|
Upstream PG18-19; packages PG18. Preload before the first agent statement; READ COMMITTED required. Human approval preserves commit guards; pg_living_assertions optional. Build pgrx 0.19.3, upstream 0.19.2. Trusted code and external effects remain outside the sandbox.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.0 | 1817161514 | pg_agent_gate | - |
| RPM | PIGSTY | 0.3.0 | 1817161514 | pg_agent_gate_$v | - |
| DEB | PIGSTY | 0.3.0 | 1817161514 | postgresql-$v-pg-agent-gate | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.3.0 el8.x86_64.pg18 : pg_agent_gate_18 pg_agent_gate_18-0.3.0-1PGSTY.el8.x86_64.rpm
| N/A | N/A | N/A | N/A |
| el8.aarch64 | PIGSTY 0.3.0 el8.aarch64.pg18 : pg_agent_gate_18 pg_agent_gate_18-0.3.0-1PGSTY.el8.aarch64.rpm
| N/A | N/A | N/A | N/A |
| el9.x86_64 | PIGSTY 0.3.0 el9.x86_64.pg18 : pg_agent_gate_18 pg_agent_gate_18-0.3.0-1PGSTY.el9.x86_64.rpm
| N/A | N/A | N/A | N/A |
| el9.aarch64 | PIGSTY 0.3.0 el9.aarch64.pg18 : pg_agent_gate_18 pg_agent_gate_18-0.3.0-1PGSTY.el9.aarch64.rpm
| N/A | N/A | N/A | N/A |
| el10.x86_64 | PIGSTY 0.3.0 el10.x86_64.pg18 : pg_agent_gate_18 pg_agent_gate_18-0.3.0-1PGSTY.el10.x86_64.rpm
| N/A | N/A | N/A | N/A |
| el10.aarch64 | PIGSTY 0.3.0 el10.aarch64.pg18 : pg_agent_gate_18 pg_agent_gate_18-0.3.0-1PGSTY.el10.aarch64.rpm
| N/A | N/A | N/A | N/A |
| d12.x86_64 | PIGSTY 0.3.0 d12.x86_64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~bookworm_amd64.deb
| N/A | N/A | N/A | N/A |
| d12.aarch64 | PIGSTY 0.3.0 d12.aarch64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~bookworm_arm64.deb
| N/A | N/A | N/A | N/A |
| d13.x86_64 | PIGSTY 0.3.0 d13.x86_64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~trixie_amd64.deb
| N/A | N/A | N/A | N/A |
| d13.aarch64 | PIGSTY 0.3.0 d13.aarch64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~trixie_arm64.deb
| N/A | N/A | N/A | N/A |
| u22.x86_64 | PIGSTY 0.3.0 u22.x86_64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~jammy_amd64.deb
| N/A | N/A | N/A | N/A |
| u22.aarch64 | PIGSTY 0.3.0 u22.aarch64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~jammy_arm64.deb
| N/A | N/A | N/A | N/A |
| u24.x86_64 | PIGSTY 0.3.0 u24.x86_64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~noble_amd64.deb
| N/A | N/A | N/A | N/A |
| u24.aarch64 | PIGSTY 0.3.0 u24.aarch64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~noble_arm64.deb
| N/A | N/A | N/A | N/A |
| u26.x86_64 | PIGSTY 0.3.0 u26.x86_64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~resolute_amd64.deb
| N/A | N/A | N/A | N/A |
| u26.aarch64 | PIGSTY 0.3.0 u26.aarch64.pg18 : postgresql-18-pg-agent-gate postgresql-18-pg-agent-gate_0.3.0-1PGSTY~resolute_arm64.deb
| N/A | N/A | N/A | N/A |
Build
You can build the RPM / DEB packages for pg_agent_gate using pig build:
Install
You can install pg_agent_gate directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources:
pg_agent_gate 0.3.0 routes registered agent roles through proposals, checks, dry runs and guarded execution on PostgreSQL 18/19, with optional human approval before commit. The library must be loaded before the first agent statement, through shared preload or a role-level session preload followed by reconnection.
Core Workflow
Operational Boundaries
Install as a superuser and register ordinary roles with narrow table privileges, row limits and a DDL allow-list. The API includes agent_gate.whoami, agent_gate.discover, agent_gate.propose, agent_gate.dry_run, agent_gate.commit and agent_gate.acts. Verbs require READ COMMITTED. Proposal-time session settings are checked again before dry-run/commit, and reads that invoke known state-changing built-ins are rejected. Re-registering a name does not inherit old proposals. agent_gate.max_proposal_bytes and agent_gate.max_intent_bytes bound input sizes. Existing duplicate committed proposals can block the upgrade and require inspection. Optional bound checks use pg_living_assertions. Rollback cannot undo every sequence or external effect; existing privileged code must remain trusted. The server log can contain literal SQL. Attempt records participate in the outer transaction, and the default fast durability mode can lose recent records on a crash.
Human Approval
Set p_requires_approval when calling agent_gate.register_agent to require consent for that agent’s proposals. A member of agent_gate_approver records consent with agent_gate.approve; the agent then commits its own proposal. Approval executes no SQL and does not bypass row limits, assertions or commit-time checks. The agent cannot approve itself, and propose_and_commit cannot bypass the approval requirement.
The fixed agent_gate_internal schema stores proposals, executions and approvals; agents do not access those tables directly. The execution record identifies the approver in approved_by.
Library and SQL Upgrades
The library retains the 0.2.15 protections against function-running argument casts and lone-semicolon crashes. Replace the library and restart or reconnect every process that preloads it, then update each database to 0.3.0 using the supplied SQL upgrade. The 0.3.0 migration adds approval objects and is not a no-op. Treat DDL permission as schema power that row-count limits do not bound.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)