Docs/Platform Integrations/n8n

n8n Integration

Protect your n8n AI agent workflows with full-spectrum security monitoring — canary tokens, DLP masking, workflow tamper detection, and real-time alerts — in under 10 minutes.


How the n8n AI Agent works

n8n's AI Agent node is not a simple pass-through. It runs a ReAct reasoning loop — on each trigger, it autonomously decides whether to call a tool (Search, HTTP Request, Code) or ask the LLM for the next step. A single workflow trigger can result in dozens of LLM calls as the agent works through a task.

The LLM lives in a Chat Model sub-node attached to the AI Agent node. That sub-node holds the credential. Trappr intercepts at exactly that point — swap the Chat Model credential to the Trappr Gateway, and every LLM call in the agent's loop is automatically monitored, regardless of how many the agent decides to make.

Trigger
webhook / schedule
AI Agent Node — ReAct loop
HTTP Tool
Search Tool
Code Tool
Chat Model
sub-node
credential: Trappr
Trappr Gateway
every LLM call
OpenAI
LLM provider
Key insight: One workflow trigger can cause 5–20 LLM calls as the agent loops through its reasoning. All of them hit the Trappr Gateway because the credential is set in the Chat Model sub-node — not in the workflow trigger or any individual step.

Prerequisites

  • An n8n instance (self-hosted or n8n Cloud)
  • A Trappr account with an app created in the dashboard
  • Your Trappr Gateway API key (cht_gw_*) and LLM provider key added under Provider Settings
Don't have an app yet? Go to Dashboard → Apps → New app and create one. Copy the Gateway API key from the Access Keys tab.

Setup

1
Create a new OpenAI credential in n8n

In n8n, go to Credentials → New credential → OpenAI API. Set the API Key field to your Trappr Gateway key (cht_gw_*), and set the Base URL to:

Text
https://gateway.trappr.net/v1

Name it clearly — e.g. Trappr Gateway (GPT-4o) — so you can tell it apart from your direct OpenAI credential.

2
Update your AI Agent node to use the Trappr credential

Open your AI Agent workflow. Click on the AI Agent node (or any OpenAI node in the workflow). In the Credential dropdown, select the Trappr Gateway credential you just created.

Leave the model selection as-is — the model name is passed through to your configured provider.

3
Test the workflow

Trigger the workflow manually once. In the Trappr dashboard under Gateway → Logs, you should see a new entry with the model, token count, and timestamp.

4
Register the workflow as an agent (optional but recommended)

In the Trappr dashboard, go to Agents → Register agent. Select n8n as the platform. This enables tamper detection — Trappr will alert you if the workflow is modified outside normal deployment.

Using the HTTP Request node

If your workflow uses the HTTP Request node to call OpenAI directly (instead of the AI Agent node), update the URL and Authorization header:

FieldOriginal valueTrappr value
URLhttps://api.openai.com/v1/chat/completionshttps://gateway.trappr.net/v1/chat/completions
Authorization headerBearer sk-proj-...Bearer cht_gw_...
BodyUnchangedUnchanged

Workflow tamper detection

Trappr can detect when your n8n workflow definition is modified. This guards against:

  • Unauthorized nodes added to the workflow (e.g. an exfiltration step)
  • Modified system prompts or tool configurations
  • Rerouted LLM calls to a different provider or endpoint

When Trappr detects a tamper event, it fires an alert immediately and — in ENFORCE mode — deactivates the agent key so the modified workflow cannot execute.

Workflow tamper detection requires the workflow to be registered as an agent in Trappr. Ad-hoc workflows that aren't registered are monitored at the gateway level only (canary tokens and DLP still apply).

Supported n8n nodes

NodeSupportedNotes
AI AgentFullUse Trappr credential in the Chat Model sub-node
OpenAIFullUpdate credential to Trappr Gateway
HTTP Request (OpenAI endpoint)FullUpdate URL and Authorization header
AnthropicPartialUse HTTP Request node with Trappr Anthropic endpoint
LangChain nodesFullSee LangChain guide