Multi-Agent AI Framework with Claude & n8n (Repo Included)

I’ve been seeing the same problem in the n8n community for months:

Agents fail. Not because of the model. Not because of the integration. Because of the system prompt.

Infinite loops. Random tool calls. Malformed JSON. Agents getting hijacked by the very data they just retrieved.

Most guides don’t explain this because they were written for ChatGPT, not for n8n’s ReAct loop.

So, I built the framework I wish I’d had:

-> 10 specific techniques for n8n agents
14 profiles with exact fixes
38 anti-patterns with before/after examples
Ready-to-copy templates
HITL, MCP security, RAG, and multi-agent support

Everything is open source. Everything is free.

:link: GitHub - mpkripto-code/n8n-agent-prompt-master: Production-grade system prompt framework for n8n AI agents. Covers context engineering, HITL gates, MCP security, Think Tool patterns, and multi-agent orchestration. 10 templates · 14 agent profiles · 38 anti-patterns. · GitHub

If you build with n8n, this will save you hours of debugging.

#n8n #promptengineering #aiagents #llm #automation[1]


  1. https://www.linkedin.com/in/navarro-swellio/Footnotes ↩︎

1 me gusta

Looks like this could save folks a ton of hair pulling. I’ve bumped into those looping agents more times than I want to admit, so having clear anti patterns and ready templates sounds like a lifesaver. One thing I’m curious about is whether you plan to add example workflows that mix multiple profiles in a single chain, since that’s where things usually get messy for me.

The system prompt hijacking issue you described is one of the most subtle bugs in production multi-agent systems, most people only catch it after a bad run in prod.

One pattern that’s worked well: wrapping all tool output through a structured extraction node before it re-enters the agent context. Acts as a sanitizer, strips everything except the fields you explicitly defined, so unexpected instruction-shaped text in fetched data can’t corrupt the next loop iteration.

Worth adding to your profiles:

a max-iteration circuit breaker at the *workflow* level, not just in the system prompt.

Even well-written prompts can loop if the tool call result is ambiguous.

A counter node that exits after N iterations catches the cases your prompt can’t anticipate.

Really solid write-up, especially the honest Data Tables vs Postgres comparison — most posts like this skip the “what I rejected and why” part.

Two things from running a similar setup:

One question on your layer 2. Since skill bodies enter context as tool call results, doesn’t that mean they land after the dynamic conversation turns, so you get no prefix cache hits on them at all? For skills that fire on most turns (in my case a formatting skill fired ~80% of the time) I ended up promoting that one back into the static system prompt and only lazy-loading the rare ones. Curious if you measured cost before/after or if the 8000→lean win was mostly latency.

Second, on the storage layer: the thing that eventually hurt me with prompts-in-Postgres wasn’t the fetching, it was editing. Every wording tweak meant psql or a scratch admin page, and the person who actually owned the brand voice rules (not me) couldn’t touch them. I ended up using a small tool for exactly this — each prompt gets a stable ID and a REST endpoint, so in n8n it’s just an HTTP Request node:

GET https://promptary.dev/api/v1/prompts/<id> with a bearer key, response has a text field you drop into the agent’s system message via {{ $json.text }}. Edit in the UI, next execution picks it up, workflow untouched.