AutomationFlowsAI & RAG › Payload Harness — Test Agent (webhook)

Payload Harness — Test Agent (webhook)

Payload Harness — Test Agent (Webhook). Uses agent, lmChatOpenAi, memoryBufferWindow, toolCalculator. Webhook trigger; 10 nodes.

Webhook trigger★★★★☆ complexityAI-powered10 nodesAgentOpenAI ChatMemory Buffer WindowTool CalculatorTool Http Request
AI & RAG Trigger: Webhook Nodes: 10 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Payload Harness \u2014 Test Agent (Webhook)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "test-agent",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "f8b3a2c1-4d5e-4f60-9a1b-2c3d4e5f6071",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1a1a1a1-1111-4111-8111-111111111101",
              "name": "chatInput",
              "type": "string",
              "value": "={{ ($json.body ?? $json).input?.text ?? '' }}"
            },
            {
              "id": "a1a1a1a1-1111-4111-8111-111111111102",
              "name": "sessionID",
              "type": "string",
              "value": "={{ ($json.body ?? $json).sessionID ?? $execution.id }}"
            },
            {
              "id": "a1a1a1a1-1111-4111-8111-111111111103",
              "name": "requestID",
              "type": "string",
              "value": "={{ ($json.body ?? $json).requestID ?? $execution.id }}"
            }
          ]
        },
        "options": {}
      },
      "id": "b1b1b1b1-2222-4222-8222-222222222201",
      "name": "Map Harness Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "You are the Payload harness test agent. Reply helpfully and concisely. Use the Calculator tool when the user asks for math. Use the Payload_Read tool when the user asks to inspect approved Payload CMS content. Only read collections approved for this target site, prefer low limits and depth 0, and summarize results instead of dumping full documents. If chatInput is empty, greet the user and confirm the harness is working."
        }
      },
      "id": "c1c1c1c1-3333-4333-8333-333333333301",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        520,
        300
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.2
        }
      },
      "id": "d1d1d1d1-4444-4444-8444-444444444401",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        520,
        520
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Map Harness Input').item.json.sessionID }}",
        "contextWindowLength": 10
      },
      "id": "e1e1e1e1-5555-4555-8555-555555555501",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        680,
        520
      ]
    },
    {
      "parameters": {},
      "id": "f1f1f1f1-6666-4666-8666-666666666601",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        840,
        520
      ]
    },
    {
      "parameters": {
        "toolDescription": "Read approved collections from the configured target Payload CMS site using its REST API. Use this for retrieval only. Input placeholders: collection is the Payload collection slug; limit defaults to a small number; depth should usually be 0.",
        "method": "GET",
        "url": "https://replace-with-target-payload-site.example.com/api/{collection}?limit={limit}&depth={depth}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": false,
        "sendHeaders": false,
        "sendBody": false,
        "placeholderDefinitions": {
          "values": [
            {
              "name": "collection",
              "description": "Approved Payload collection slug to read, for example pages, posts, or media.",
              "type": "string"
            },
            {
              "name": "limit",
              "description": "Maximum documents to return. Use a small number such as 5 or 10 unless the user asks for more.",
              "type": "number"
            },
            {
              "name": "depth",
              "description": "Payload relationship depth. Use 0 by default and never exceed 2.",
              "type": "number"
            }
          ]
        },
        "optimizeResponse": true,
        "responseType": "json",
        "fieldsToInclude": "selected",
        "fields": "docs.id,docs.title,docs.slug,docs.updatedAt,totalDocs,page,totalPages,hasNextPage",
        "truncateResponse": false
      },
      "id": "f2f2f2f2-6767-4676-8676-676767676701",
      "name": "Payload_Read",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "typeVersion": 1.1,
      "position": [
        1000,
        520
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b2b2b2b2-1111-4111-8111-111111111101",
              "name": "content",
              "type": "string",
              "value": "={{ $json.output ?? $json.text ?? 'Harness response received' }}"
            },
            {
              "id": "b2b2b2b2-1111-4111-8111-111111111102",
              "name": "status",
              "type": "string",
              "value": "succeeded"
            },
            {
              "id": "b2b2b2b2-1111-4111-8111-111111111103",
              "name": "n8nExecutionID",
              "type": "string",
              "value": "={{ $execution.id }}"
            }
          ]
        },
        "options": {}
      },
      "id": "a2a2a2a2-7777-4777-8777-777777777701",
      "name": "Build Harness Response",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        780,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        }
      },
      "id": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1040,
        300
      ]
    },
    {
      "parameters": {
        "content": "## After import\n\n1. Attach **Payload Test Agent Bearer** on the Webhook node.\n2. Attach **OpenAI account** on **OpenAI Chat Model**.\n3. Optional: attach **Target Payload read API key** on **Payload_Read**, then replace the URL host with the target Payload site origin. Use a read-only API key user scoped to approved collections.\n4. Keep **Calculator** and **Payload_Read**, or add more tool sub-nodes.\n5. Publish the workflow, sync into Payload, then run **Set up test agent**.\n\nPayload sends `input.text`, `sessionID`, and `requestID` in the webhook body. **Map Harness Input** normalizes those fields for the agent. **Build Harness Response** shapes the JSON Payload expects.",
        "height": 340,
        "width": 500,
        "color": 5
      },
      "id": "s1s1s1s1-8888-4888-8888-888888888801",
      "name": "Setup Notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        40
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Map Harness Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Harness Input": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Build Harness Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Harness Response": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Payload_Read": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": [
    {
      "name": "payload-harness"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Payload Harness — Test Agent (Webhook). Uses agent, lmChatOpenAi, memoryBufferWindow, toolCalculator. Webhook trigger; 10 nodes.

Source: https://github.com/transformable-app/transformable-nodesui/blob/main/docs/n8n-workflows/test-agent-webhook.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

VEP WAPP. Uses openAi, lmChatOpenAi, toolCalculator, agent. Webhook trigger; 100 nodes.

OpenAI, OpenAI Chat, Tool Calculator +7
AI & RAG

L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.

HTTP Request, Agent, Google Calendar Tool +9
AI & RAG

Flux. Uses lmChatOpenAi, agent, googleGemini, httpRequest. Webhook trigger; 67 nodes.

OpenAI Chat, Agent, Google Gemini +8
AI & RAG

🧪 LABR - nuevo asistente (REPARADO). Uses httpRequest, postgres, postgresTool, toolCalculator. Webhook trigger; 63 nodes.

HTTP Request, Postgres, Postgres Tool +9
AI & RAG

🧪 LABR - nuevo asistente (REPARADO). Uses httpRequest, postgres, postgresTool, toolCalculator. Webhook trigger; 63 nodes.

HTTP Request, Postgres, Postgres Tool +9