Automation library · Content

Govern AI agent responses with OpenAI and Postgres

Started by another system calling it, and works across Gmail and Postgres. 32 steps, 5 branches: large, and worth reading before you trust it with anything live.

Large

32 stepsLarge: read it before trusting it with anything live
5Branches: places the flow splits
0Loops or waits
2Services it connects to

The flow

Starts it 1Logic 24Service 7

The steps in the order they run, from what starts it.

  1. 1AgentGuard - Request EntryWebhookStarts it
  2. 2AgentGuard - Request NormalizerCodeLogic
  3. 3AgentGuard - Security GateCodeLogic
  4. 4AgentGuard - Security DecisionIfLogic
  5. 5AgentGuard - Query EmbeddingHttp RequestService
  6. 6AgentGuard - Security RejectionCodeLogic
  7. 7AgentGuard - Embedding NormalizerCodeLogic
  8. 8AgentGuard - Semantic RetrievalPostgresService
  9. 9AgentGuard - Grounding EngineCodeLogic
  10. 10AgentGuard - Grounding DecisionIfLogic
  11. 11AgentGuard - Agent Policy & PromptCodeLogic
  12. 12AgentGuard - Grounding EscalationCodeLogic
  13. 13AgentGuard - Tool Intent NormalizerCodeLogic
  14. 14AgentGuard - Tool GatewayCodeLogic
  15. 15AgentGuard - Tool Risk & PermissionsCodeLogic
  16. 16AgentGuard - Tool Approval DecisionIfLogic
  17. 17AgentGuard - Controlled Tool ExecutionCodeLogic
  18. 18AgentGuard - Tool Approval QueueCodeLogic
  19. 19AgentGuard - Tool Result ValidatorCodeLogic
  20. 20AgentGuard - Agent RuntimeHttp RequestService
  21. 21AgentGuard - Output NormalizerCodeLogic
  22. 22AgentGuard - Verification EngineHttp RequestService
  23. 23AgentGuard - Verification DecisionCodeLogic
  24. 24AgentGuard - Verification GateIfLogic
  25. 25AgentGuard - Cost ControllerCodeLogic
  26. 26AgentGuard - Repair & RetryCodeLogic
  27. 27AgentGuard - Risk EngineHttp RequestService
  28. 28AgentGuard - Risk DecisionCodeLogic
  29. 29AgentGuard - Human Approval DecisionIfLogic
  30. 30AgentGuard - Observability & AuditPostgresService
  31. 31AgentGuard - Human Approval QueueCodeLogic
  32. 32AgentGuard - Output DeliveryGmailService

How it's built

Starts on
Another system calling it
Steps
32, with 5 branches
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Postgres
Model
None. This is plumbing, not judgement

Questions

What does it need to run?

An n8n account, plus your own Gmail and Postgres accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 32 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 32 steps before you point it at anything that matters.