n8n Webhook-Triggered AI Agent

Expose an n8n AI Agent (with memory and tools) behind a webhook that returns the answer synchronously.

n8nwebhookai-agentapi
Setup time1 hour (estimate)
Estimated costn8n plus LLM tokens per request.
Toolsn8n
VerificationLast verified 2026-10-14

Nodes

  1. Webhook (POST /agent, Respond: Using 'Respond to Webhook' node).
  2. AI Agent (@n8n/n8n-nodes-langchain.agent), prompt from {{ $json.body.message }}.
    Sub-node Chat Model (OpenAI, Anthropic, Ollama, ...).
    Sub-node Window Buffer Memory keyed on {{ $json.body.session_id }}.
    Tool sub-nodes, e.g. HTTP Request Tool, Calculator.
  3. Respond to Webhook – JSON { "reply": "{{ $json.output }}" }.

Test

curl -X POST https://YOUR-N8N/webhook/agent \
  -H 'Content-Type: application/json' \
  -d '{"session_id":"u123","message":"What is 17% of 2,340?"}'

Hardening

Failure modes

Markdown version: /blueprints/n8n-webhook-ai-agent.md

Want a deeper build of this?

Vote for an extended, fully tested version (more tools, a full workflow file). Votes decide what we build next.

– votes

Get one fully built blueprint a week

A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.

Related blueprints