§ DOCUMENTATION
n8n-Integration
Fügen Sie Execlave-Guardrails auf drei Wegen zu Ihren n8n-KI-Workflows hinzu: importieren Sie eine Vorlage, fragen Sie einen Copiloten oder bauen Sie es manuell auf.
Voraussetzungen
X-API-Key.Wählen Sie Ihren Weg
Wählen Sie die schnellste Route für Ihr Team. Alle drei Wege enden in derselben governed Architektur.
Sofort einrichten mit einem Copiloten
Fügen Sie diesen Prompt und Ihr aktuelles n8n-Workflow-JSON in einen KI-Assistenten ein. Er liefert eine governed Version mit Pre-Enforce- und Post-Trace-Knoten zurück.
I'm using n8n. Modify my workflow so every LLM call passes through Execlave — an AI agent governance platform that runs at the HTTP layer (enforce policies before the call, log traces after). Context for you (the assistant):- Execlave API host: https://api.execlave.com- Auth: header `X-API-Key: <EXECLAVE_API_KEY>` on every request. In n8n this is a "Header Auth" credential.- Two endpoints matter: POST /api/v1/policies/enforce body: { agentId: "<UUID>", input: "<user input>", environment: "production", estimatedCost?: number, tools?: string[] } 200 -> { allowed: true, warnings: [...] } // run the model 403 -> { allowed: false, violations: [...] } // block, return reason to caller 202 -> { allowed: false, requiresApproval: true, approvalRequestId, pollUrl, violations } // human gate POST /api/v1/traces/ingest body: { traces: [{ traceId, agentId, status: "success"|"error"|"policy_blocked", input, output, modelName, promptTokens, completionTokens, totalTokens, costUsd?, environment }] } How to modify my workflow:1. Find every HTTP Request node that calls an LLM (OpenAI, Anthropic, Gemini, Mistral, etc.) OR every `@n8n/n8n-nodes-langchain.agent` node.2. Insert a new HTTP Request node BEFORE it, named "Execlave: Enforce": - POST to https://api.execlave.com/api/v1/policies/enforce - Header Auth credential "Execlave API Key" - Body (JSON): { "agentId": "<my-agent-uuid>", "input": "<reference the same prompt the LLM node uses>", "environment": "production" } - Under Options → Response, enable "Never Error" and "Full Response" so we can branch on the status code.3. Insert an IF node after enforce. Condition: `{{ $json.body.allowed }}` is true. - TRUE branch -> original LLM node. - FALSE branch -> Respond to Webhook with the reason from `violations[0].message`, HTTP 403.4. AFTER the LLM node, insert another HTTP Request node named "Execlave: Ingest Trace": - POST to https://api.execlave.com/api/v1/traces/ingest - Same Header Auth credential - Body: { "traces": [{ "traceId": "={{ $execution.id }}", "agentId": "<same external id>", "status": "success", "input": "<same user input>", "output": "<LLM response text>", "modelName": "<model name>", "promptTokens": <n>, "completionTokens": <n>, "environment": "production" }] }5. If any enforce call returns 202 with `requiresApproval: true`, that means a policy is in require_approval mode. Add a Wait node (30s) + HTTP GET to `pollUrl` + IF on `$json.body.data.status === "approved"` to proceed or deny.6. Leave my existing happy-path logic intact. Only add Execlave gates and traces around LLM calls. Return the full modified workflow JSON, node-by-node. Do not ask me follow-up questions — make reasonable defaults and note them in comments.Vorlage importieren
Starten Sie mit einem erprobten Flow und tauschen Sie nur Ihre Zugangsdaten, Ihre Agent-ID und die Modelleinstellungen aus.
Enforce + LLM + Trace
Gate every LLM call with policy enforcement, run the model only if allowed, and log the trace. The canonical governed-workflow shape — use this for 80% of cases.
Ungefähre Anzahl Knoten: 7
{ "name": "Execlave — Enforce + LLM + Trace", "nodes": [ { "parameters": { "httpMethod": "POST", "path": "execlave-chat", "responseMode": "responseNode", "options": {} }, "id": "webhook-1", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 2, "position": [ 240, 320 ] }, { "parameters": { "method": "POST", "url": "https://api.execlave.com/api/v1/policies/enforce", "authentication": "predefinedCredentialType", "nodeCredentialType": "httpHeaderAuth", "sendBody": true, "bodyContentType": "json", "jsonBody": "={\n \"agentId\": \"REPLACE_WITH_AGENT_UUID\",\n \"input\": \"={{ $json.body.message }}\",\n \"environment\": \"production\",\n \"estimatedCost\": 0.02\n}", "options": { "response": { "response": { "fullResponse": true, "neverError": true } } } }, "id": "enforce-1", "name": "Execlave: Enforce", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 460, 320 ], "credentials": { "httpHeaderAuth": { "id": "", "name": "Execlave API Key" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "allowed-check", "leftValue": "={{ $json.body.allowed }}", "rightValue": true, "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "id": "if-allowed-1", "name": "IF allowed", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [ 680, 320 ] }, { "parameters": { "method": "POST", "url": "https://api.openai.com/v1/chat/completions", "authentication": "predefinedCredentialType", "nodeCredentialType": "openAiApi", "sendBody": true, "bodyContentType": "json", "jsonBody": "={\n \"model\": \"gpt-4\",\n \"messages\": [{ \"role\": \"user\", \"content\": \"={{ $('Webhook').item.json.body.message }}\" }]\n}", "options": {} }, "id": "openai-1", "name": "OpenAI", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 900, 220 ], "credentials": { "openAiApi": { "id": "", "name": "OpenAI account" } } }, { "parameters": { "method": "POST", "url": "https://api.execlave.com/api/v1/traces/ingest", "authentication": "predefinedCredentialType", "nodeCredentialType": "httpHeaderAuth", "sendBody": true, "bodyContentType": "json", "jsonBody": "={\n \"traces\": [{\n \"traceId\": \"={{ $execution.id }}\",\n \"agentId\": \"my-n8n-agent\",\n \"status\": \"success\",\n \"input\": \"={{ $('Webhook').item.json.body.message }}\",\n \"output\": \"={{ $json.choices[0].message.content }}\",\n \"modelName\": \"gpt-4\",\n \"promptTokens\": \"={{ $json.usage.prompt_tokens }}\",\n \"completionTokens\": \"={{ $json.usage.completion_tokens }}\",\n \"totalTokens\": \"={{ $json.usage.total_tokens }}\",\n \"environment\": \"production\"\n }]\n}", "options": {} }, "id": "trace-1", "name": "Execlave: Ingest Trace", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1120, 220 ], "credentials": { "httpHeaderAuth": { "id": "", "name": "Execlave API Key" } } }, { "parameters": { "respondWith": "json", "responseBody": "={{ { answer: $('OpenAI').item.json.choices[0].message.content } }}", "options": {} }, "id": "respond-ok-1", "name": "Respond OK", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [ 1340, 220 ] }, { "parameters": { "respondWith": "json", "responseBody": "={{ { blocked: true, reason: $('Execlave: Enforce').item.json.body.violations[0].message } }}", "options": { "responseCode": 403 } }, "id": "respond-blocked-1", "name": "Respond Blocked", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [ 900, 440 ] } ], "connections": { "Webhook": { "main": [ [ { "node": "Execlave: Enforce", "type": "main", "index": 0 } ] ] }, "Execlave: Enforce": { "main": [ [ { "node": "IF allowed", "type": "main", "index": 0 } ] ] }, "IF allowed": { "main": [ [ { "node": "OpenAI", "type": "main", "index": 0 } ], [ { "node": "Respond Blocked", "type": "main", "index": 0 } ] ] }, "OpenAI": { "main": [ [ { "node": "Execlave: Ingest Trace", "type": "main", "index": 0 } ] ] }, "Execlave: Ingest Trace": { "main": [ [ { "node": "Respond OK", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }}In n8n: Workflows → Import from JSON, Vorlage einfügen, dann Zugangsdaten und IDs setzen.
Manuell aufbauen
Nutzen Sie diesen Weg, wenn Sie bereits einen Workflow haben und nur Governance-Knoten um bestehende LLM-Schritte hinzufügen möchten.
Header-Auth-Zugangsdaten anlegen
Öffnen Sie in n8n Credentials → Add Credential → Header Auth. Setzen Sie den Header-Namen auf X-API-Key und den Wert auf Ihren Execlave-Schlüssel.
Enforce-Knoten vor dem LLM-Knoten hinzufügen
Fügen Sie einen HTTP-Request-Knoten ein, der an https://api.execlave.com/api/v1/policies/enforce postet, mit Ihrer Agent-ID und der Nutzereingabe.
Verzweigung auf allowed
Fügen Sie einen IF-Knoten mit der Bedingung {{ $json.body.allowed }} hinzu. Bei „true" geht es weiter zum LLM-Knoten. Bei „false" wird 403 mit der ersten Verstoßmeldung zurückgegeben.
Trace nach der Modellantwort erfassen
Fügen Sie nach dem LLM-Aufruf einen weiteren HTTP-Request-Knoten hinzu, der an https://api.execlave.com/api/v1/traces/ingest postet. Geben Sie Trace-ID, Modell, Ein-/Ausgabe sowie, falls verfügbar, Token-Metadaten an.
Verhalten bei Ausfällen festlegen
Entscheiden Sie sich für fail-open oder fail-closed bei Ausfällen des Execlave-Knotens, indem Sie die n8n-Fehlerbehandlung und Alarmierungsrichtlinie für den Knoten konfigurieren.
Verwendung des n8n-AI-Agent-Knotens
Für @n8n/n8n-nodes-langchain.agent-Flows: erzwingen Sie vor dem Agenten und erfassen Sie den Trace nach der Agentenausgabe.
Behalten Sie diese Struktur bei: Chat Trigger → Enforce → IF allowed → AI Agent → Ingest Trace.
{ "agentId": "REPLACE_WITH_AGENT_UUID", "input": "={{ $json.chatInput }}", "environment": "production", "tools": ["web_search", "calculator"]}Menschliche Freigabe-Schleife
Bei Policies im require_approval-Modus wird gewartet und abgefragt, bis eine explizite menschliche Entscheidung vorliegt.
Wenn die Enforcement-Antwort requiresApproval: true zurückgibt, verwenden Sie einen Wait-Knoten, fragen Sie anschließend den Freigabe-Endpunkt über pollUrl ab und verzweigen Sie, wenn data.status gleich approved ist.
{ "step1": "POST /api/v1/policies/enforce", "expect202": { "requiresApproval": true, "approvalRequestId": "apr_123", "pollUrl": "/api/v1/approvals/apr_123" }, "step2": "Wait 30s", "step3": "GET {{ pollUrl }}", "branch": { "approved": "execute action + ingest trace", "denied": "stop action + respond with reason" }}Enforcement-Modi
| Modus | Verhalten | Wann verwenden |
|---|---|---|
block | Stoppt die Ausführung sofort bei einem Verstoß. | Produktions-Flows mit strengen Compliance-Anforderungen. |
warn | Lässt die Ausführung zu, gibt aber Warnungen zurück. | Schrittweise Einführung vor harter Blockierung. |
monitor | Protokolliert Policy-Treffer ohne den Flow zu unterbrechen. | Baseline-Lernen und Tuning von Fehlalarmen. |
require_approval | Pausiert risikoreiche Aktionen, bis ein Mensch entscheidet. | Rückerstattungen, ausgehende Nachrichten, Datenänderungen. |
Fehlerbehandlung & Troubleshooting
Enforcement nicht erreichbar
Konfigurieren Sie ein explizites fail-open- oder fail-closed-Verhalten. Bei fail-open senden Sie eine Benachrichtigung, damit übersprungene Guardrails sichtbar sind.
401 unauthorized
Prüfen Sie, ob die Zugangsdaten auf den richtigen Schlüssel verweisen und der Schlüssel für diese Umgebung aktiv ist.
403 blocked
Zeigen Sie den ersten Verstoß aus dem Antwort-Payload an: $json.body.violations[0].message.
429 rate limit
Fügen Sie für stoßweise auftretende Workflows einen Wait-Knoten hinzu und wiederholen Sie mit exponentiellem Backoff.
Trace-Validierungsfehler
Stellen Sie sicher, dass status gültig ist und Token-/ Kostenfelder numerisch sind. Halten Sie Trace-Batches bei 100 oder weniger Einträgen.
Keine Traces im Dashboard
Bestätigen Sie, dass der Ingest-Knoten nach jedem LLM-Aufruf läuft und agentId mit Ihrem registrierten Agenten übereinstimmt.
Checkliste vor dem Go-Live
Wie geht es weiter?
Policies & Sicherheit
Erkennung, Schwellenwerte und Enforcement-Modi anpassen.
REST-API-Referenz
Alle Request-/Response-Felder für Enforce, Trace und Freigaben einsehen.
Agenten-Dashboard
Status prüfen, Agenten pausieren und Policy-Status überprüfen.
Trace-Explorer
Governed Ausführungen überprüfen und Fehler beheben.