Automation library · Content

Wrap and self-heal AI agent tools with HTTP and Postgres

Started by an event in a connected app, and works across Postgres. 25 steps, 5 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large

25 stepsLarge: read it before trusting it with anything live
5Branches: places the flow splits
1Loop or waits
1Service it connects to

The flow

Starts it 2Logic 20Service 3

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

  1. 1When Called by ToolExecute Workflow triggerStarts it
  2. 2Demo, Manual TriggerManual triggerStarts it
  3. 3Parse Tool InputCodeLogic
  4. 4Demo, Sample Tool CallSetLogic
  5. 5IF, Parse OK?IfLogic
  6. 6IF, Requires Approval?IfLogic
  7. 7Return Tool ResultSetLogic
  8. 8Build Approval ContextSetLogic
  9. 9Route by Tool NameSwitchLogic
  10. 10Wait for Approval (Form)WaitLogic
  11. 11Execute HTTP RequestHttp RequestService
  12. 12Validate SQL (read-only)CodeLogic
  13. 13Execute Web SearchHttp RequestService
  14. 14Unknown Tool → TOOL_ERRORSetLogic
  15. 15Process DecisionCodeLogic
  16. 16HTTP Success → Tool ResultCodeLogic
  17. 17HTTP Error → TOOL_ERRORCodeLogic
  18. 18IF, SQL Valid?IfLogic
  19. 19Search Success → Tool ResultCodeLogic
  20. 20Search Error → TOOL_ERRORCodeLogic
  21. 21IF, Approved?IfLogic
  22. 22Execute Postgres QueryPostgresService
  23. 23PG Invalid → Pass-throughSetLogic
  24. 24PG Success → Tool ResultCodeLogic
  25. 25PG Error → TOOL_ERRORCodeLogic

How it's built

Starts on
An event in a connected app
Steps
25, with 5 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Postgres
Model
None. This is plumbing, not judgement

Questions

What does it need to run?

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

What starts it?

It starts on an event in a connected app.

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 25 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 25 steps before you point it at anything that matters.