A workflow to cut loops and API costs in n8n multi-agent setups
This Reddit post describes a workflow for running several AI agents together in n8n. The author says it addresses agents looping endlessly, producing malformed JSON, and quickly spending Claude API budget. The workflow uses a PFAF structure with separate roles, budget tracking, and JSON validation.
Key points
- The post focuses on a multi-agent workflow in n8n.
- It targets endless loops, malformed JSON, and fast Claude API spending.
- PFAF separates agents into defined roles with strict rules.
- The setup includes budget tracking and JSON validation.
- The main lesson is to control agent behavior before token costs grow.
Quick term guide
- AI agents
- AI agents are AI tools that can carry out steps toward a goal, not just answer once.
- Claude API
- A way for software or automations to call Claude AI directly.
- validation
- Checking whether real people understand, want, or would use an idea before spending more time on it.
- multi-agent workflow
- A setup where two or more AI tools each handle different parts of a job and pass results between them
- multi-agent
- A setup where several AI agents each handle a different subtask and work together to complete a larger goal.
- agent workflow
- A set of steps an AI follows automatically to complete a series of tasks in order.
- token costs
- Token costs are the fees paid for the text an AI model reads and writes.
- token cost
- The money or usage spent when sending text to an AI model and getting text back.