# Audit an n8n AI agent workflow for security and reliability

**Use case:** 

Review an AI Agent workflow the way you would review any other production automation. Checks the tools an agent can call, the model and memory sub-nodes wired into it, what happens to the agent's output downstream, and whether anything catches a failure. Sub-node connections are walked in the direction n8n runs them, so language models, memories and tools are never reported as unreachable.

## Input

```json
{
  "workflowJson": {
    "name": "Customer support AI agent",
    "nodes": [
      {
        "id": "1",
        "name": "When chat message received",
        "type": "@n8n/n8n-nodes-langchain.chatTrigger",
        "typeVersion": 1.1,
        "position": [
          0,
          0
        ],
        "parameters": {
          "public": true,
          "options": {}
        }
      },
      {
        "id": "2",
        "name": "AI Agent",
        "type": "@n8n/n8n-nodes-langchain.agent",
        "typeVersion": 1.7,
        "position": [
          260,
          0
        ],
        "parameters": {
          "options": {
            "systemMessage": "=You are support for {{ $json.chatInput }}. Answer from the knowledge base."
          }
        }
      },
      {
        "id": "3",
        "name": "OpenAI Chat Model",
        "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
        "typeVersion": 1.2,
        "position": [
          140,
          240
        ],
        "parameters": {
          "model": "gpt-4o-mini",
          "options": {}
        },
        "credentials": {
          "openAiApi": {
            "id": "8",
            "name": "OpenAi account"
          }
        }
      },
      {
        "id": "4",
        "name": "Window Buffer Memory",
        "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
        "typeVersion": 1.2,
        "position": [
          300,
          240
        ],
        "parameters": {}
      },
      {
        "id": "5",
        "name": "Order lookup tool",
        "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
        "typeVersion": 1.1,
        "position": [
          460,
          240
        ],
        "parameters": {
          "url": "https://api.acme.test/orders",
          "toolDescription": "Look up an order by id"
        },
        "credentials": {
          "httpHeaderAuth": {
            "id": "6",
            "name": "Orders API header auth"
          }
        }
      },
      {
        "id": "6",
        "name": "Escalate to human",
        "type": "n8n-nodes-base.code",
        "typeVersion": 2,
        "position": [
          520,
          0
        ],
        "parameters": {
          "jsCode": "await fetch('https://hooks.slack.com/services/T000/B000/XXXX', { method: 'POST', body: JSON.stringify($json) });\nreturn $input.all();"
        }
      },
      {
        "id": "7",
        "name": "Log transcript",
        "type": "n8n-nodes-base.postgres",
        "typeVersion": 2.4,
        "position": [
          780,
          0
        ],
        "parameters": {
          "operation": "executeQuery",
          "query": "=INSERT INTO transcripts (session, body) VALUES ('{{ $json.sessionId }}', '{{ $json.output }}')",
          "options": {}
        },
        "credentials": {
          "postgres": {
            "id": "5",
            "name": "Postgres account"
          }
        }
      },
      {
        "id": "8",
        "name": "Notes",
        "type": "n8n-nodes-base.stickyNote",
        "typeVersion": 1,
        "position": [
          1040,
          0
        ],
        "parameters": {
          "content": "Swap the memory for Redis before launch"
        }
      }
    ],
    "connections": {
      "When chat message received": {
        "main": [
          [
            {
              "node": "AI Agent",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "AI Agent": {
        "main": [
          [
            {
              "node": "Escalate to human",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Escalate to human": {
        "main": [
          [
            {
              "node": "Log transcript",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "OpenAI Chat Model": {
        "ai_languageModel": [
          [
            {
              "node": "AI Agent",
              "type": "ai_languageModel",
              "index": 0
            }
          ]
        ]
      },
      "Window Buffer Memory": {
        "ai_memory": [
          [
            {
              "node": "AI Agent",
              "type": "ai_memory",
              "index": 0
            }
          ]
        ]
      },
      "Order lookup tool": {
        "ai_tool": [
          [
            {
              "node": "AI Agent",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      }
    },
    "settings": {}
  },
  "workflowUrls": [],
  "workflowIds": [],
  "activeOnly": false,
  "ruleSet": "all",
  "minSeverity": "low",
  "ignoreRules": [],
  "includeReport": false
}
```

## Output

```json
{
  "severity": {
    "label": "Severity",
    "format": "string"
  },
  "rule": {
    "label": "Rule ID",
    "format": "string"
  },
  "ruleTitle": {
    "label": "Rule",
    "format": "string"
  },
  "category": {
    "label": "Category",
    "format": "string"
  },
  "workflowName": {
    "label": "Workflow",
    "format": "string"
  },
  "nodeName": {
    "label": "Node",
    "format": "string"
  },
  "nodeType": {
    "label": "Node type",
    "format": "string"
  },
  "message": {
    "label": "Finding",
    "format": "string"
  },
  "parameterPath": {
    "label": "Parameter",
    "format": "string"
  },
  "evidence": {
    "label": "Evidence (masked)",
    "format": "string"
  },
  "remediation": {
    "label": "How to fix",
    "format": "string"
  },
  "docsUrl": {
    "label": "Docs",
    "format": "string"
  }
}
```

## About this Actor

This example demonstrates how to use [n8n Workflow Auditor - Linter & Security Review](https://apify.com/mediocre_interest/n8n-workflow-auditor.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/mediocre_interest/n8n-workflow-auditor.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
This Task's input is already configured above — use it as-is rather than inventing a new one.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/mediocre_interest/n8n-workflow-auditor.md

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).
