Skip to content

n8n Community Nodes for AP3

n8n Community nodes are npm packages, hosted in the npm registry. n8n-nodes-ap3 is a n8n community node for enabling secure multi-party computation between agents without revealing private data using AP3 specifications.

n8n-nodes-ap3 provides 4 n8n nodes that make it easy to discover agents, check compatibility, and execute secure computations.

Details of nodes

1. AP3 Discover Agent

Discover and fetch agent cards from AP3-enabled agents.

Parameters: - agentUrl: Base URL of the agent (e.g., http://localhost:10001) - timeout: Request timeout in milliseconds (default: 5000) - validateAP3: Ensure agent supports AP3 extension (default: true)

Output:

{
  "name": "Supplier Agent",
  "url": "http://localhost:10001",
  "capabilities": {
    "extensions": ["AP3_EXTENSION"]
  },
  "skills": [...]
}


2. AP3 Compatibility Check

Check if two agents can perform secure computation together.

Parameters: - requiredOperation: Required operation (SFE, PSI, etc.) - minimumScore: Minimum compatibility score 0.0-1.0 - strictMode: Fail on any incompatibility

Output:

{
  "compatible": true,
  "score": 1.0,
  "explanation": "Compatible - Roles: receiver + initiator | Operations: SFE",
  "agentA": {...},
  "agentB": {...}
}


3. AP3 Start Workflow

Initiate a secure computation workflow between compatible agents.

Parameters: - initiatorUrl: URL of the initiator agent - receiverUrl: URL of the receiver agent - customMessage: Custom task description - waitForCompletion: Wait for task to complete (default: true) - pollingInterval: Status check interval in seconds (default: 5) - timeout: Maximum wait time in seconds (default: 60)

Output:

{
  "taskId": "abc-123-def-456",
  "status": "completed",
  "result": {
    "value": 18750,
    "status": "PASS"
  }
}


4. AP3 Get Result

Extract and format results from completed AP3 tasks.

Parameters: - outputFormat: Format (text, number, json) - extractField: Custom field path (e.g., result.value)

Output:

{
  "result": 18750,
  "formatted": "The secure dot product result is 18750",
  "status": "completed"
}


Installation

Install n8n globally with npm

npm install n8n -g

To install or update to a specific version of n8n use the @ syntax to specify the version. For example:

npm install -g n8n@0.126.1

After the installation, start n8n by running:

n8n
# or
n8n start

For more information, see the n8n documentation.

Install the n8n-nodes-ap3 package

Option 1: Build from Source

Use this option if you want to modify the nodes or contribute to development.

Prerequisites

  • Node.js 18 or higher
  • npm
  • n8n installed (globally or locally)

Step 1: Clone and Install Dependencies

# Clone the repository
git clone https://github.com/silence-laboratories/ap3.git
cd ap3/src/integrations/n8n-nodes-ap3

# Install dependencies
npm install

Step 2: Build the Package

npm run build

This will: - Compile TypeScript files to JavaScript - Copy node icons to the dist/ folder - Generate the package in dist/

Verify the build:

ls dist/nodes/

# Should show: 

# AP3CompatibilityCheck/ 
# AP3DiscoverAgent/ 
# AP3GetResult/ 
# AP3StartWorkflow/

For global n8n installation:

# In the n8n-nodes-ap3 directory
npm link

# Link globally
npm link n8n-nodes-ap3 -g

For local n8n installation:

# In the n8n-nodes-ap3 directory
npm link

# Navigate to your n8n directory
cd /path/to/your/n8n

# Link the package
npm link n8n-nodes-ap3

Step 4: Restart n8n

# Stop n8n if running (Ctrl+C or kill the process)

# Start n8n
n8n start

# Or if using Docker
docker restart n8n

Step 5: Verify Installation

  1. Open n8n in your browser (default: http://localhost:5678)
  2. Click on the + button to add a node
  3. Search for "AP3"
  4. You should see 4 nodes:
  5. AP3 Discover Agent
  6. AP3 Compatibility Check
  7. AP3 Start Workflow
  8. AP3 Get Result

Quick Start

1. Start AP3 Agents

First, you need running AP3 agents to work with. See the AP3 examples for how to start agents.

Example:

cd examples/dot-product/google-adk
export GOOGLE_API_KEY=your_key_here
./run_example.sh

Wait for agents to start:

✓ Supplier Agent running on http://localhost:10001
✓ Manufacturer Agent running on http://localhost:10002

2. Create a Workflow

Option A: Import Example Workflow

  1. Open n8n (http://localhost:5678)
  2. Click Import from File
  3. Select src/ap3/integrations/n8n-nodes-ap3/examples/simple-workflow.json from this repository
  4. Click Import

Option B: Build Manually

Create a workflow with these nodes in order:

1. Manual Trigger
   ↓
2. AP3 Discover Agent (configure for Supplier: http://localhost:10001)
   ↓
3. AP3 Discover Agent (configure for Manufacturer: http://localhost:10002)
   ↓
4. AP3 Compatibility Check
   ↓
5. AP3 Start Workflow
   ↓
6. AP3 Get Result

3. Execute the Workflow

  1. Click Test workflow or Execute workflow
  2. Watch the nodes execute (green checkmarks)
  3. Click on the final node to view the result

Expected result:

{
  "result": 18750,
  "formatted": "The secure dot product result is 18750",
  "status": "completed"
}


Use Cases

Supply Chain

Supplier and manufacturer securely evaluate product compatibility without revealing pricing or formula details.

Finance

Banks calculate joint risk scores without sharing customer data.

Healthcare

Hospitals compare patient data for research without exposing PII.

Advertising

Ad platforms match audiences without sharing user lists.


Development

Project Structure

n8n-nodes-ap3/
├── nodes/                              # Node implementations
│   ├── AP3DiscoverAgent/
│   │   ├── AP3DiscoverAgent.node.ts   # Node logic
│   │   └── ap3-discover.svg           # Node icon
│   ├── AP3CompatibilityCheck/
│   ├── AP3StartWorkflow/
│   └── AP3GetResult/
├── examples/                           # Example workflows
│   ├── simple-workflow.json
│   └── advanced-workflow.json
├── package.json                        # Package configuration
├── tsconfig.json                       # TypeScript config
├── gulpfile.js                         # Build tasks
└── README.md                           # This file

Available Scripts

npm run build       # Build the package (TypeScript + icons)
npm run dev         # Watch mode for development
npm run lint        # Check code style
npm run lintfix     # Fix code style issues
npm run format      # Format code with Prettier

Troubleshooting

Nodes don't appear in n8n

Solution:

# Verify the link
npm list -g --depth=0 | grep n8n-nodes-ap3

# Re-link if needed
npm link
npm link n8n-nodes-ap3 -g

# Completely restart n8n
pkill -f n8n
n8n start

Build fails

Solution:

# Clean and reinstall
rm -rf node_modules dist package-lock.json
npm install
npm run build

Can't connect to agents

Solution:

# Check if agents are running
curl http://localhost:10001/.well-known/agent.json
curl http://localhost:10002/.well-known/agent.json

# Restart agents if needed
cd /path/to/ap3/examples/dot-product/google-adk
./run_example.sh

Enable debug logging

N8N_LOG_LEVEL=debug n8n start

Resources