DEV Community

Cover image for From Legacy to Modern: How We Rebuilt 45 n8n AI Agents After Getting Called Out on Reddit
Miguel Abarca
Miguel Abarca

Posted on

From Legacy to Modern: How We Rebuilt 45 n8n AI Agents After Getting Called Out on Reddit

The Post That Changed Everything

Six months ago, I posted our 45-workflow n8n AI agent pack to r/n8n. Proud moment — until a comment pointed out we were using legacy aiAgent nodes (pre-LangChain integration).

They were right. The old architecture:

  • n8n-nodes-base.aiAgent with aiProvider/model/credential fields
  • No proper tool calling abstraction
  • Connections by internal IDs (brittle on import)
  • No sub-node chat model pattern

We didn't argue. We rebuilt.


The Modern Architecture (v3.1)

Every workflow now uses:


json
{
  "type": "@n8n/n8n-nodes-langchain.agent",
  "typeVersion": 3.1,
  "position": [200, 300],
  "parameters": {
    "promptType": "define",
    "text": "={{ $json.input }}",
    "options": {
      "systemMessage": "=You are a BANT qualification specialist...",
      "maxIterations": 5
    }
  }
}
With a sub-node chat model:
{
  "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
  "typeVersion": 1,
  "position": [200, 100],
  "parameters": {
    "modelName": "gemini-1.5-pro",
    "temperature": 0.1
  },
  "credentials": {
    "googleAiApi": "Google AI Studio"
  }
}
Connected via ai_languageModel — not the old credential field.
The 5 Prompt Patterns That Actually Work
After rebuilding 45 agents across 9 categories, these patterns separate production-ready from demo-only:
1. Job Description > Chat Prompt
System prompts structured like job postings:
role: "BANT Qualification Specialist"
responsibilities:
  - "Score leads 0-100 on Budget, Authority, Need, Timeline"
  - "Output deterministic JSON: score, verdict, next_action"
constraints:
  - "Never hallucinate fields not in payload"
  - "Escalate if confidence < 0.75"
escalation_rules:
  - "Below threshold → human review queue"
kpis:
  - "Accuracy > 90% on test set"
  - "False positive rate < 5%"
2. Few-Shot Examples Eliminate 90% Format Errors
Every agent includes 3 worked examples:
{
  "input": {"lead": {"budget_status": "approved", "decision_maker_check": "yes"}},
  "reasoning": "Budget approved + decision maker = strong signal",
  "output": {"score": 85, "verdict": "warm", "next_action": "Send case study"}
}
3. Chain-of-Thought as Explicit Stages
Not "think step by step" — define stages:
stages:
  1. analyze_context: "What fields are present? What's missing?"
  2. identify_intent: "What is this lead actually asking for?"
  3. draft: "Build JSON response"
  4. self_check: "Validate against schema, check confidence"
  5. escalate_if: "confidence < 0.75 → human"
4. Confidence Calibration as Safety Gate
Each agent scores its own confidence:
// Deterministic scoring (no LLM cost)
const score = calculateBANT(payload.lead);
const confidence = score >= 80 ? 0.95 : score >= 60 ? 0.75 : 0.5;
if (confidence < 0.75) return { escalate: true, reason: "Low confidence" };
5. Test Adversarial, Not Happy Paths
const adversarialTests = [
  {}, // empty payload
  { lead: { budget_status: "approved", decision_maker_check: "conflicting" }},
  { lead: { pain_point_validation: "" }}, // ambiguous
];
Live Demo (No Setup Required)
Test the BANT agent right now:
curl -X POST https://miguelabarca.app.n8n.cloud/webhook/bant-qualification \
  -H "Content-Type: application/json" \
  -d '{"lead":{"lead_email":"john@acme.com","company":"Acme Corp","lead_name":"John Smith","budget_status":"approved","decision_maker_check":"yes","pain_point_validation":"manual reporting","timeline_proximity":"this quarter"}}'
Returns: {"score":100,"verdict":"hot","next_action":"Book discovery call"}
Architecture notes:
- responseMode: "lastNode" — no Respond to Webhook node needed
- Payload in body.lead (n8n 2.35+)
- Deterministic JS scoring — zero LLM cost, zero latency
- Runs on n8n Cloud Free tier (14-day trial)
The Catalog (70 Products, All v3.1)
Tier    Products    Price
Free    4 workflows (RSS, BANT, Cart Recovery, KB)  $0
Individual  45 agents (9 categories)    $29 each
Niche Packs E-com, Real Estate, SaaS (12 each)  $29
Workflow Pack   All 45 + bonuses    $29
Prompts Pro 45 blueprints + Handbook    $27
Vertical Bundles    SaaS/Enterprise/Agency  $79/$79/$149
Lifetime License    53 products, future included    $49
Active codes: LAUNCH30 (30% off) · FLASH59 ($20 off bundles)
What We Learned
1. Community feedback > internal QA — The r/n8n catch saved our reputation
2. Modern architecture isn't optional — Legacy nodes don't exist in current n8n
3. Deterministic > LLM for scoring — BANT at 0 cost, 0 latency, 100% reproducible
4. Audit gates are non-negotiable — sanity-v13.mjs (0 errors = gate) catches everything
5. Distribution is the real bottleneck — 70 products, 0 sales, all tech debt paid
Try It Yourself
Free tier: 4 production workflows → https://miguelabarca.gumroad.com/l/xetpfq
Live demo: BANT agent → https://miguelabarca.app.n8n.cloud/webhook/bant-qualification
Full catalog: https://miguelabarca.gumroad.com (code LAUNCH30 = 30% off)
Building AI agents in n8n? The prompt patterns above work regardless of your stack. The architecture patterns (job descriptions, few-shot, CoT stages, confidence gates, adversarial testing) are universal.
What's your highest-stakes agent — and what's its confidence threshold?
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.