Skip to main content
Last updated on

n8n Integration Walkthrough

This guide shows how to add OpenBox governance to an n8n agent without rewriting it. The integration point is a single node: OpenBox: Agent replaces n8n's standard AI Agent node and accepts the same Chat Model, Memory, and Tool connections.

Existing agent?

If you only need the shortest setup path, start with Wrap an Existing Agent.

Prerequisites

  • n8n with Community Nodes enabled (self-hosted, or n8n Cloud with community node installs allowed)
  • An existing (or new) AI Agent node connected to a Chat Model sub-node
  • An OpenBox agent registration with an API key
  • The OpenBox agent DID and private key unless Require signing is disabled

Part 1: Register Your Agent In OpenBox

  1. Open the OpenBox Dashboard
  2. Navigate to Agents
  3. Create or open the agent you want to govern
  4. Generate an API key
  5. Copy the generated DID and private key unless Require signing is disabled
  6. Keep the credentials in your n8n credential store

Part 2: Install The Node

Package: n8n-nodes-openbox-hook

In n8n, go to Settings → Community Nodes → Install and enter:

n8n-nodes-openbox-hook

Restart n8n if prompted.

If you build your own n8n image instead of installing through the UI, install it as a regular dependency and rebuild:

npm install n8n-nodes-openbox-hook

Part 3: Add OpenBox Credentials

In n8n, go to Settings → Credentials → Add Credential and create an OpenBox API credential:

FieldRequiredDescription
API KeyYesAgent API key issued by OpenBox.
Agent DIDNoRequired for agents with signing_required = true.
Agent Private KeyNoBase64-encoded raw 32-byte Ed25519 seed, paired with Agent DID.

Part 4: Replace The Node

workflow.json (node excerpt)
{
"type": "n8n-nodes-openbox-hook.openBoxAgent",
"typeVersion": 1,
"parameters": {
"promptType": "auto",
"options": {}
},
"credentials": {
"openBoxApi": {
"id": "1",
"name": "OpenBox API"
}
}
}

Reconnect the same Chat Model, Memory, and Tool sub-nodes the original agent had, and copy over the Prompt setting and any Options (System Message, Max Iterations, Return Intermediate Steps, Automatically Passthrough Binary Images).

Part 5: Verify A Live Run

Run one real request through the governed agent, then check OpenBox for:

  • a run under the registered agent
  • model call events with prompt and response metadata
  • tool call activities with started and completed events, if tools executed
  • HTTP and database telemetry captured during the run
  • governance decisions for allowed, blocked, halted, or approval-required operations
  • signed request authentication when Require signing is enabled

Open the OpenBox Dashboard, navigate to Agents, open the agent, and inspect the latest run.

How The Integration Works

The node runs the same four lifecycle stages as the LangChain SDK's middleware, called directly inside the node's execute() function:

StagePurpose
beforeAgentEmits SignalReceived(user_prompt) and WorkflowStarted, and starts the OpenBox run
wrapModelCallEmits LLMStarted, applies input-side guardrails, invokes the connected Chat Model, then emits LLMCompleted
wrapToolCallEmits ToolStarted, invokes the connected Tool sub-node, then emits ToolCompleted
afterAgentEmits WorkflowCompleted with a completed or failed status — this always fires, even when the agent loop errors

The node also patches Node's https module and instruments outbound database queries for the duration of the run, so HTTP and database activity during a model or tool call is captured as telemetry attached to that call.

Tool Invocation

Every Tool sub-node connected to the agent is governed automatically — there is no tool_type_map-style classification step in the node UI. The tool name the agent calls (the LangChain tool's name) is the name that appears on ToolStarted / ToolCompleted events.

Human-in-the-Loop Approvals

If OpenBox returns REQUIRE_APPROVAL, the node polls the OpenBox approval endpoint every 5 seconds for up to 5 minutes by default. If the request is rejected or the poll times out, the node raises GovernanceHaltError and the agent run stops.

See Error Handling for the exception types and recommended handling patterns.

Next Steps

  1. Configuration — Review credential fields, node parameters, and current defaults
  2. Error Handling — Handle governance decisions with Continue On Fail
  3. Troubleshooting — Diagnose missing runs, credential errors, and telemetry gaps