Build a Multi-Agent Team in n8n

Orchestrate a Researcher, Writer, and Critic AI agent team in n8n.

Introduction

30 Second Summary

Asking one person to research a topic, write about it, and then critique their own work produces mediocre results. Real teams divide those responsibilities so each specialist can focus on what they do best.

In this project, you will build a team of AI agents inside n8n that research, write, and critique content as a coordinated pipeline. An orchestrator agent delegates to three specialist sub-agents, each running as its own reusable workflow.

What You'll Build

You type a topic into a chat window and get back a polished briefing that has been researched with live web data, drafted by a specialist writer, and sharpened by an editorial critic.

By the end of this project, you'll have:

  • A chat-powered orchestrator where you type a topic and receive a fully researched, drafted, and critiqued briefing in one shot.
  • Three reusable sub-workflows (Researcher, Writer, and Critic) you can open, inspect, and plug into any future automation project.
  • A self-hosted web search engine feeding your agents real, current information so their output is grounded in facts, not hallucinations.
  • Secret Mission: a revision loop where the Critic can reject weak drafts and demand rewrites, with safety guardrails to prevent runaway loops.

Are there any prerequisites?

This project uses Docker and Docker Compose to run n8n and a search engine locally. Step 1 covers the full setup, including installation if you don't have these tools yet.

Before We Start

Before We Start...

Before we dive in, let's lock in what you're about to build and why it matters.

You're going to build a team of AI agents that work together, each one a specialist at a single job. One agent researches, one writes, and one critiques. An orchestrator coordinates all three and hands you back a polished deliverable.

Set Up n8n, SearXNG, and OpenRouter

You now know what you are building: a multi-agent orchestrator in n8n that delegates work to a Researcher, Writer, and Critic. Before any of those agents can exist, you need the infrastructure they run on.

In this step you will get three pieces of infrastructure running. Docker Compose launches n8n (the workflow engine) and SearXNG (a self-hosted search engine) on the same network. OpenRouter provides a single API key that gives all three agents access to LLM models.

In this step, get ready to:
  • Install Docker and Docker Compose, then create the project folder and configuration files.
  • Start n8n and SearXNG with Docker Compose and confirm both services are healthy.
  • Create an OpenRouter account, generate an API key, and add it as a credential inside n8n.
Install Docker and create your project files

n8n and SearXNG both run as Docker containers. Docker Compose orchestrates them so they start together on the same network. You need Docker Engine with the Compose plugin (v2) installed.

  • Open your terminal and check whether Docker Compose is already installed by running:
docker compose version

✔️ I see a version number

Docker and the Compose plugin are ready. Move on to creating the project folder below.

ⓧ Docker is installed but compose is not recognized

You have Docker Engine but the Compose plugin is missing. Install it by running:

sudo apt-get update
sudo apt-get install docker-compose-plugin
  • After the install finishes, verify by running:
docker compose version

You should now see a version number starting with v2.

ⓧ Command not found

Docker is not installed at all. Install Docker Engine and the Compose plugin together using the official convenience script by running:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

What does this script do?

The convenience script detects your Linux distribution, configures the package manager, and installs the latest stable Docker Engine, containerd, and the Compose plugin automatically. It requires sudo because it modifies system packages.

  • After the install finishes, verify by running:
docker compose version

You should see a version number starting with v2.

Permission denied when running docker?

On some Linux distributions, your user may not have permission to use Docker without sudo. You can add your user to the docker group by running sudo usermod -aG docker $USER, then logging out and back in.

Help me fix Docker permission issues on Linux.

  • Move to your Desktop by running this command:
cd ~/Desktop
  • Create your project folder and move into it by running these commands:
mkdir multi-agent-n8n
cd multi-agent-n8n

Now you need two configuration files. The first is compose.yml, which tells Docker Compose which containers to run. The second is searxng-settings.yml, which enables the JSON response format that n8n needs.

  • Create compose.yml by opening a new file in your text editor and pasting the following:
services:
  searxng:
    image: ghcr.io/searxng/searxng:latest
    environment:
      SEARXNG_SECRET: change-me-searxng-secret
    volumes:
      - ./searxng-settings.yml:/etc/searxng/settings.yml:ro

  n8n:
    image: docker.io/n8nio/n8n
    ports:
      - "5678:5678"
    environment:
      GENERIC_TIMEZONE: "UTC"
      TZ: "UTC"
      N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: "true"
      N8N_RUNNERS_ENABLED: "true"
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

What does this file do?

This Compose file defines two services. searxng runs the SearXNG search engine and mounts your custom settings file. n8n runs the workflow engine and exposes port 5678 so you can open it in a browser.

Both services automatically join the same Docker network, which means n8n can reach SearXNG at http://searxng:8080 without any extra networking configuration. The n8n_data volume keeps your workflows and settings safe across container restarts.

  • Save compose.yml in your multi-agent-n8n folder.
  • Confirm the file exists by running:
ls

You should see compose.yml in the output.

  • Create searxng-settings.yml by opening a new file and pasting the following:
use_default_settings: true
search:
  formats:
    - html
    - json

Why do you need this file?

By default SearXNG only serves HTML responses. n8n's SearXNG Tool node sends requests expecting JSON data. Adding json to the formats list enables that format so the tool node can parse search results correctly.

  • Save searxng-settings.yml in your multi-agent-n8n folder.
  • Confirm both files exist by running:
ls

You should see compose.yml and searxng-settings.yml in the output.

✔️ Awesome, I've got everything!

Great. Make sure both files are saved in your multi-agent-n8n folder before moving on.

ⓧ I'd like to double check the full code

Scroll up and confirm you have both files:

  • compose.yml with the searxng service, n8n service, and n8n_data volume.
  • searxng-settings.yml with use_default_settings: true and the formats list containing html and json.

Files not showing up in ls?

Make sure you saved both files to the multi-agent-n8n folder on your Desktop, not to a different directory. Run pwd to confirm your terminal is inside ~/Desktop/multi-agent-n8n.

Help me find my project files.

Start the services with Docker Compose

Both configuration files are in place. Time to start the containers and confirm n8n and SearXNG are running.

  • Start both services in the background by running:
docker compose up -d

What does this command do?

The -d flag runs the containers in detached mode, meaning they run in the background and give you your terminal back. Docker Compose pulls the n8n and SearXNG images (this may take a minute on the first run), creates the containers, and starts them on a shared network.

Docker will pull the images the first time you run this. Wait for the output to show both containers have started.

  • Before you open n8n in your browser, what do you think you will see at http://localhost:5678? A login page, a dashboard, or something else?
  • Open your browser and navigate to:
http://localhost:5678

You should see the n8n setup screen asking you to create an owner account. This confirms n8n is running successfully.

  • Enter your name, email address, and a password. Your password must be at least 8 characters long, include at least one number, and include at least one capital letter.
  • Click Next. n8n logs you in with your new owner account.

What is this setup screen?

The first time you open a self-hosted n8n instance, it asks you to create an owner account. This account is the admin for your instance and is stored locally in the Docker volume. You will use it every time you open n8n.

Can't reach localhost:5678?

Check that the containers are running by running docker compose ps in your terminal. Both searxng and n8n should show a status of Up. If a container exited, check its logs with docker compose logs n8n.

Help me troubleshoot my Docker Compose services.

Connect OpenRouter to n8n

Your agents need an LLM to think with. OpenRouter provides a single API key that gives you access to hundreds of models, including free ones. You will create an account, generate a key, and save it inside n8n as a credential.

  • Open a new browser tab and go to openrouter.ai.
  • Click the sign-up option and create a free account.

What is OpenRouter?

OpenRouter is a unified API that routes requests to 500+ LLM models across 80+ providers. Instead of signing up for individual providers, you get a single API key. The free tier includes 25+ models with 50 requests per day, which is more than enough for this project.

  • After signing in, navigate to the API keys page at openrouter.ai/settings/keys.
  • Click Create Key.
  • Give your key a name (for example, n8n-agents) and click Create.
  • Copy the API key immediately. It is only shown once.

Save your API key somewhere safe

OpenRouter only displays the full API key at the moment you create it. Copy it and paste it into a temporary note or password manager before closing the dialog. If you lose it, you will need to create a new key.

Now add this key to n8n so your AI Agent nodes can use it.

  • Switch back to the n8n tab in your browser (http://localhost:5678).
  • Click the dropdown arrow next to the Create workflow button in the top right.
  • Select Create credential.
  • Search for OpenRouter and select it from the results.
  • Paste your OpenRouter API key into the API Key field.
  • Click Save.

n8n confirms the credential is saved. Any AI Agent node you create can now use this OpenRouter credential to call LLM models.

Can't find OpenRouter in the credential list?

Make sure you are searching for OpenRouter (one word, capital O and R). If it does not appear, your n8n version may be too old. Check that your n8n container is running the latest image by running docker compose pull followed by docker compose up -d to update.

Help me add OpenRouter credentials in n8n.

Your infrastructure is live. n8n is running, SearXNG is ready to answer search queries, and OpenRouter is wired up. Next up, you will build your first agent workflow and see what a single agent can do on its own.

Build a Single-Agent Workflow

Your infrastructure is up and running. n8n, SearXNG, and OpenRouter are all connected and ready to power your AI agents.

Before building a team of specialized agents, you need to see what happens when one agent tries to do everything on its own. This gives you a working baseline and reveals the limitations you will solve in the next steps.

In this step, get ready to:
  • Create a workflow with a Chat Trigger and AI Agent node.
  • Configure the AI Agent with an OpenRouter model and a system prompt.
  • Test the single agent and observe its limitations.
Create a new workflow with Chat Trigger and AI Agent

Every n8n workflow starts with a trigger node that kicks things off. For a chat-based agent, the Chat Trigger node provides a built-in chat panel you can type messages into.

  • In the n8n web UI, click Add first step on the empty canvas.
  • Search for Chat Trigger in the nodes panel.
  • Select Chat Trigger to add it to the canvas.
  • Close the node details view to return to the canvas.

Your canvas now shows the Chat Trigger node. Next, add the AI Agent node that will process messages.

  • Click the Add node connector on the Chat Trigger node.
  • Search for AI Agent in the nodes panel.
  • Select AI Agent to add it to the canvas.

n8n automatically connects the Chat Trigger's output to the AI Agent's input. You should see both nodes on the canvas with a line between them.

What is the AI Agent node?

The AI Agent node lets you pair a chat model with tools so the agent can decide which tools to call to complete a task. In this step you are using it without any tools, so it will simply pass your message to the language model and return whatever the model generates.

Attach an OpenRouter Chat Model and set the system prompt

The AI Agent needs a language model to think with. You will attach an OpenRouter Chat Model sub-node and tell the agent what role to play using a system prompt.

  • Double-click the AI Agent node on the canvas to open its settings.
  • Under the Model connector at the bottom of the node panel, click the + button to add a chat model.
  • Search for OpenRouter Chat Model and select it.
  • In the Credential for OpenRouter API dropdown, select the OpenRouter credential you created in Step 1.
  • In the Model dropdown, select a free model from the list.

Which model should I pick?

n8n dynamically loads models from your OpenRouter account, so the dropdown only shows models available to you. Any model marked as free will work for this project. You can also select the openrouter/free option if available. It automatically routes your request to a free model.

  • Close the OpenRouter Chat Model sub-node to return to the AI Agent settings.

Now set the system prompt that tells the agent what role to play.

  • In the AI Agent node settings, scroll down and click Add Option, then select System Message.
  • Paste the following system prompt into the System Message field:
You are a content team. When given a topic, research it thoroughly, write a clear briefing, and then critique your own work. Return the final revised version.

What does the system message do?

The System Message runs before the conversation starts. It shapes the agent's behavior for every message the user sends.

This prompt asks one agent to do three jobs at once: research, write, and critique. You will soon see why that is a problem.

  • Close the AI Agent node to return to the canvas.

Your canvas now shows Chat Trigger connected to AI Agent, with the OpenRouter Chat Model attached as a sub-node beneath the agent.

Don't see the OpenRouter Chat Model under the agent?

Make sure you clicked the + button on the Model connector of the AI Agent node, not the Add node connector on the canvas. Sub-nodes like the Chat Model attach to specific connectors on the agent, not to the main workflow chain.

If the model dropdown is empty, confirm your OpenRouter credential is saved with a valid API key.

Help me attach the OpenRouter Chat Model to my AI Agent node.

Test the single agent and observe its limitations

Your single-agent workflow is wired up. Time to see what it can actually do.

  • Open the Chat Trigger node by double-clicking it.
  • Click the Chat button at the bottom of the n8n editor to open the chat panel.

Before you send your first message, think about what you expect. You asked the agent to research, write, and critique. Do you think it will produce a well-researched briefing with real, current facts?

  • Type the following message into the chat panel and press Enter:
Write me a 200-word briefing on the current state of quantum computing

Wait for the agent to respond. Read the output carefully.

The agent returns a response, but look closely at what it produced.

What should I see?

You will get a briefing that looks plausible at first glance. But notice two key problems:

  • The agent has no web access. Any statistics, dates, or "recent developments" it mentions are invented. The model is generating text from its training data, not searching for current information.
  • The research, writing, and critique all blur together in a single unstructured stream. There is no separation of concerns. One prompt is doing three jobs at once, and none of them gets the focused attention it deserves.

These two limitations are exactly what you will fix over the next two steps. Step 3 gives the agent real web search through a dedicated Researcher sub-workflow. Step 4 splits the writing and critique into their own specialized agents.

You have seen firsthand what a single agent can and cannot do. Next up, you will build a Researcher sub-workflow with live web search and wire it into the orchestrator so it stops making things up.

Build the Researcher Sub-Workflow

In Step 2, you saw the single-agent approach firsthand. The agent made up facts and crammed research, writing, and critique into one messy stream.

The fix starts with the biggest gap: real information. In this step, you will build a dedicated Researcher Agent that searches the live web through SearXNG and wire it into your orchestrator as a callable tool. Instead of hallucinating, the orchestrator will delegate research to a specialist that returns verified, current findings.

In this step, get ready to:
  • Build a Researcher Agent sub-workflow with live web search via SearXNG.
  • Wire the Researcher into your orchestrator using the Call n8n Workflow Tool node.
  • Test the orchestrator and confirm it calls the Researcher and returns real, web-sourced data.
Create the Researcher Agent workflow

The Researcher will be a completely separate workflow that the orchestrator calls like a tool. It receives a topic, searches the web, and returns structured findings.

  • In n8n, click the n8n logo in the top-left corner to return to the main dashboard.
  • Click Create Workflow to start a new workflow.
  • Click the workflow name at the top of the canvas (it defaults to something like "My workflow") and rename it to Researcher Agent.

You should see a blank canvas titled Researcher Agent.

Now add the trigger that lets other workflows call this one.

  • Click the + button on the canvas to add a node.
  • Search for Execute Sub-workflow Trigger and select it.
  • In the node's settings panel, set Input data mode to Define using fields below.
  • Click Add Field to add an input field.
  • Set the field name to topic and the type to String.

Why define typed fields?

Setting the input mode to Define using fields below creates a typed schema for the sub-workflow. When the orchestrator's AI Agent calls this workflow as a tool, it knows exactly what parameters to fill in (a topic string). Without a schema, the agent has nothing to map inputs to.

You should see the trigger node on the canvas with the topic field listed. Close the trigger node's settings panel.

Next, add the AI Agent that will do the actual research work.

  • Click the + connector on the right side of the Execute Sub-workflow Trigger node.
  • Search for AI Agent and select it to add the node and connect it to the trigger.
  • Click the AI Agent node to open its settings.
  • In the System Message field, paste this prompt:
You are a research specialist. Given a topic, search the web for current, factual information. Return a structured summary of your findings with key facts, statistics, and sources.

What does this prompt do?

This prompt gives the Researcher a single, focused job: search the web and return structured findings. Compare this to the single-agent prompt from Step 2 that tried to research, write, and critique all at once.

Asking for "key facts, statistics, and sources" pushes the agent to structure its output in a way the Writer agent can consume later.

  • Attach an OpenRouter Chat Model sub-node to the AI Agent. You did this in Step 2. Click the Model connector at the bottom of the AI Agent node, search for OpenRouter Chat Model, and select it.
  • Select the same OpenRouter credential you created in Step 1.
  • Choose a free model from the Model dropdown.

Your canvas now has two nodes (Execute Sub-workflow Trigger and AI Agent) connected by an arrow, with the OpenRouter Chat Model attached below the AI Agent.

The Researcher can think, but it cannot search the web yet. The next step gives it that ability.

  • Click the Tool connector at the bottom of the AI Agent node (next to the Model connector).
  • Search for SearXNG and select the SearXNG tool node.
  • In the SearXNG node's credential dropdown, click Create New Credential.
  • In the API URL field, enter http://searxng:8080.
  • Click Save to store the SearXNG credential.

Why searxng:8080 instead of localhost?

Both n8n and SearXNG run as Docker containers on the same Docker Compose network. Inside that network, containers reach each other by service name, not localhost. The service name searxng comes from the key you used in compose.yml.

  • Close the SearXNG node's settings panel.
  • Save the workflow by pressing Cmd+S (macOS) or Ctrl+S (Windows).

Your Researcher Agent canvas should show three connected elements: the Execute Sub-workflow Trigger at the left, the AI Agent in the middle, with the OpenRouter Chat Model and SearXNG Tool attached below it.

SearXNG credential failing to save?

  • Make sure the URL is exactly http://searxng:8080. Using localhost instead of searxng will not work because n8n runs inside a container, not on your host machine.
  • Confirm your SearXNG container is still running. Switch to your terminal and run docker compose ps from your project folder. Both services should show a healthy or running state.
  • help me troubleshoot my SearXNG credential in n8n
Wire the Researcher into the orchestrator

The Researcher Agent exists as its own workflow, but the orchestrator does not know about it yet. You need to add a tool node that tells the orchestrator "here is a workflow you can call when you need research done."

  • Click the n8n logo in the top-left corner to return to the main dashboard.
  • Open the orchestrator workflow you built in Step 2.
  • Click the Tool connector at the bottom of the AI Agent node.
  • Search for Call n8n Workflow Tool and select it.

The Call n8n Workflow Tool node settings panel opens. This is where you point the orchestrator at the Researcher Agent.

  • In the Description field, enter:
Call this tool to research a topic. The input should be the topic to research.

Why does the description matter?

The AI Agent reads this description to decide when to use the tool. Think of it like API documentation for the agent. A vague description means the agent might not call the tool at the right time.

  • Under Source, select Database.
  • In the Workflow dropdown, find and select Researcher Agent.
  • Click Refresh next to Workflow Inputs to pull in the input fields from the Researcher Agent.

You should see the topic field appear under Workflow Inputs. This field was pulled in from the typed schema you defined on the Researcher Agent's trigger.

  • On the right side of the topic field, click the small AI button (it may show as a sparkle icon) to let the model define this parameter.

What does $fromAI() do?

Clicking that button inserts a $fromAI() expression into the field. This tells the AI Agent: "you decide what value to put here based on the user's request." When a user asks the orchestrator about quantum computing, the agent fills in topic with "quantum computing" automatically.

Now update the orchestrator's system prompt so it knows to use the Researcher tool.

  • Close the Call n8n Workflow Tool settings panel.
  • Click the AI Agent node to open its settings.
  • Find the System Message field. It currently says:
You are a content team. When given a topic, research it thoroughly, write a clear briefing, and then critique your own work. Return the final revised version.
  • Replace the entire system prompt with this new one:
You are a content orchestrator. When given a topic, first use the Researcher tool to gather current facts, then write a briefing based on those findings.

What changed in the prompt?

The old prompt asked one agent to do everything. The new prompt tells the orchestrator to delegate research to the Researcher tool first, then handle writing itself. The orchestrator is already evolving from "do it all" to "coordinate specialists."

  • Save the workflow by pressing Cmd+S (macOS) or Ctrl+S (Windows).

Your orchestrator canvas should now show the Chat Trigger connected to the AI Agent, with the OpenRouter Chat Model and Call n8n Workflow Tool attached below the AI Agent.

Don't see the topic field after clicking Refresh?

  • Make sure you saved the Researcher Agent workflow before switching back to the orchestrator. Unsaved sub-workflows do not expose their input fields.
  • Confirm the Researcher Agent's Execute Sub-workflow Trigger has Input data mode set to Define using fields below with the topic field defined. If it is set to Accept all data, no fields will appear.
  • help me wire my sub-workflow tool in n8n
Test the orchestrator with web-powered research

Everything is wired up. Time to see if the orchestrator actually delegates to the Researcher and gets real web data back.

  • In the orchestrator workflow, open the Chat Trigger panel by clicking the Chat button at the bottom of the canvas.

Before you send your message, think about what you expect to happen. Do you think the orchestrator will call the Researcher tool on its own, or just answer from memory like in Step 2?

  • Type this message and send it:
Write me a 200-word briefing on the current state of quantum computing
  • Wait for the agent to respond. This may take 30 seconds or more as the Researcher searches the web.

The orchestrator should return a briefing that includes real, current facts and possibly references to specific companies or recent events. Compare this to the Step 2 response. The difference is that the orchestrator now called the Researcher tool, which searched the live web through SearXNG.

  • Close the chat panel and click on the execution log (the Executions tab or the green checkmark on the AI Agent node) to inspect what happened behind the scenes.
  • Confirm that the AI Agent called the Researcher sub-workflow. You should see evidence that web searches were performed in the execution details.

What should I see in the execution log?

In the AI Agent node's execution output, look for tool call entries showing that the Researcher Agent workflow was triggered. If you click through to the sub-workflow's execution, you should see the SearXNG tool returned real search results with URLs and snippets.

Agent not calling the Researcher tool?

  • Double-check that the orchestrator's system prompt mentions using the Researcher tool. If the prompt still says "research it thoroughly" instead of "use the Researcher tool," the agent will try to do the research itself.
  • Make sure the Call n8n Workflow Tool node is connected to the AI Agent's Tool connector, not the main input connector.
  • Verify the Researcher Agent workflow is saved and has no errors. Open it, check for any red warning indicators, and save it again.
  • help me debug my orchestrator not calling the Researcher tool

Your orchestrator can now pull in real data from the web instead of hallucinating. But it is still doing the writing and critiquing in one breath. Next up, you will split those jobs into their own dedicated agents too.

Add the Writer and Critic Sub-Workflows

Your orchestrator now delegates research to a dedicated agent with live web search. The output is grounded in real data instead of hallucinated facts.

The orchestrator is still writing and critiquing in the same breath, though. Splitting these responsibilities into their own agents means each one gets a focused persona and a tailored prompt. The result is higher quality at every stage of the pipeline.

In this step, get ready to:
  • Build a Writer Agent sub-workflow and wire it to the orchestrator as a tool.
  • Build a Critic Agent sub-workflow and wire it to the orchestrator as a tool.
  • Update the orchestrator prompt and test the full three-agent pipeline end to end.
Create the Writer Agent sub-workflow

The Writer takes raw research findings and turns them into a polished briefing. You will build it using the same pattern you used for the Researcher Agent: an Execute Sub-workflow Trigger with typed input fields, an AI Agent node, and an OpenRouter Chat Model.

  • Return to the n8n home screen by clicking the n8n logo in the top left corner.
  • Click Add workflow in the top right to create a new workflow.
  • Click the workflow name at the top and rename it to Writer Agent.
  • Click the + button on the canvas to add a node. Search for Execute Sub-workflow Trigger and select it.
  • In the node settings, set Input data mode to Define using fields below.
  • Click Add Field. Set the name to topic and the type to String.
  • Click Add Field again. Set the name to research and the type to String.

Why two input fields?

The Writer needs both the topic (to stay focused) and the research findings (as source material). These typed fields give the orchestrator a schema to fill via $fromAI() when it calls this tool.

  • Close the trigger settings. Click the + button on the canvas again and search for AI Agent. Add it to the canvas.
  • Connect the trigger's output to the AI Agent's input by dragging a line between them.
  • Click the AI Agent node to open its settings. Under the Model connector at the bottom, click + and select OpenRouter Chat Model.
  • Select your OpenRouter credential and choose a free model from the Model dropdown.
  • Back in the AI Agent node settings, find the System Message field and paste this prompt:
You are a professional writer. Given a topic and research findings, write a clear, well-structured briefing of approximately 300 words. Use the research findings as your source material. Do not invent facts beyond what the research provides.

What does this prompt do?

This prompt gives the Writer a clear identity and a hard constraint: use only the research it receives. It cannot invent facts on its own, which means the final output stays grounded in the Researcher's verified findings.

  • Save the Writer Agent workflow by pressing Ctrl+S.

Your canvas should show the Execute Sub-workflow Trigger connected to the AI Agent, with the OpenRouter Chat Model attached beneath it.

Don't see the Model sub-node?

Make sure you clicked the + under the Model connector on the AI Agent node, not the main + button on the canvas. Sub-nodes attach to specific connectors on their parent node.

Help me connect the OpenRouter Chat Model to my AI Agent node.

Now wire the Writer Agent into your orchestrator so the AI Agent can call it as a tool.

  • Switch back to the orchestrator workflow by clicking the n8n logo and selecting it from the workflow list.
  • Click the AI Agent node to open its settings.
  • Under the Tool connector at the bottom, click + and select Call n8n Workflow Tool.
  • In the Source setting, select Database and choose the Writer Agent workflow from the list.
  • In the Description field, paste the following:
Call this tool to write a draft briefing. Provide the topic and research findings.

Why does the Description matter?

The Description field acts like API documentation for the AI Agent. It reads this text to decide when and how to use the tool. A clear description means the orchestrator calls the Writer at the right time with the right inputs.

  • Scroll down to the Workflow Inputs section and click Refresh to pull in the fields from the Writer Agent trigger.
  • For the topic field, click the AI button on the right side of the field. This populates it with a $fromAI() expression so the orchestrator can specify the topic.
  • For the research field, click the AI button on the right side as well.
  • Save the orchestrator workflow by pressing Ctrl+S.

Your orchestrator's AI Agent node should now show two tool sub-nodes: the Researcher and the Writer.

Create the Critic Agent sub-workflow

The Critic reviews the Writer's draft and rewrites it with improvements. You will follow the same pattern one more time.

  • Return to the n8n home screen and click Add workflow to create a new workflow.
  • Rename it to Critic Agent.
  • Add an Execute Sub-workflow Trigger node.
  • Set Input data mode to Define using fields below.
  • Add a field named topic with type String.
  • Add a second field named draft with type String.

Why draft instead of research?

The Critic works on a different input than the Writer. It receives the Writer's finished draft to evaluate, not the raw research. Naming the field draft makes this role distinction clear in the schema.

  • Add an AI Agent node and connect the trigger's output to the AI Agent's input.
  • Attach an OpenRouter Chat Model sub-node to the AI Agent using the Model connector. Select your OpenRouter credential and a free model.
  • In the AI Agent's System Message field, paste this prompt:
You are a tough but fair editorial critic. Given a draft briefing, evaluate it for accuracy, clarity, structure, and completeness. Provide specific, actionable feedback. Then rewrite the briefing incorporating your improvements. Return the final polished version.

What does this prompt do?

This prompt sets up a critic that does not just point out problems. It rewrites the draft with its own improvements baked in. The orchestrator gets back a finished, polished version instead of a list of notes it would have to interpret.

  • Save the Critic Agent workflow by pressing Ctrl+S.

Your canvas should look the same as the Writer Agent: trigger connected to AI Agent with the model sub-node attached.

Now wire the Critic into the orchestrator.

  • Switch back to the orchestrator workflow.
  • Click the AI Agent node. Under the Tool connector, click + and add another Call n8n Workflow Tool.
  • Set the Source to Database and select the Critic Agent workflow.
  • In the Description field, paste:
Call this tool to critique and improve a draft briefing. Provide the topic and the draft text.
  • In the Workflow Inputs section, click Refresh to pull in the Critic's fields.
  • Click the AI button on the topic field to populate it with $fromAI().
  • Click the AI button on the draft field to populate it with $fromAI().
  • Save the orchestrator workflow.

Your orchestrator's AI Agent node should now show three tool sub-nodes: Researcher, Writer, and Critic.

Update the orchestrator prompt and test the full pipeline

The orchestrator still has its old system prompt from when it only had the Researcher. You need to update it so it knows about all three tools and calls them in the right order.

  • In the orchestrator workflow, click the AI Agent node to open its settings.
  • Find the System Message field. It currently says:
You are a content orchestrator. When given a topic, first use the Researcher tool to gather current facts, then write a briefing based on those findings.
  • Replace the entire system message with this updated prompt:
You are a content team orchestrator. When given a topic: 1) Use the Researcher tool to gather current facts. 2) Use the Writer tool to draft a briefing from those facts. 3) Use the Critic tool to review and improve the draft. Return the Critic's final polished version as your response.

What changed in this prompt?

The new prompt gives the orchestrator an explicit three-step pipeline: research, then write, then critique. It also tells the agent to return the Critic's output as the final answer, not its own summary.

The numbered steps act as a strong guide for the LLM's tool-calling decisions. Without them, the agent might skip a step or call tools in the wrong order.

  • Save the orchestrator workflow.

Before you test, think about what you expect to happen. The orchestrator has three tools now. Do you think it will call all three, and in what order?

  • Click the Chat button in the bottom right to open the Chat Trigger panel.
  • Send a new topic that is different from your earlier tests. Try something like:
Write me a 200-word briefing on the latest developments in renewable energy storage.
  • Wait for the response to come back. This may take a minute since three agents are running in sequence.
  • After the response arrives, click Executions in the left sidebar and open the most recent execution to see the execution log.

In the execution log, you should see the orchestrator called the Researcher first, then the Writer, then the Critic. Each one is a separate sub-workflow execution. The final output is a polished briefing that has been researched with real web data, drafted by the Writer, and critiqued and improved by the Critic.

What should I see in the execution log?

The log shows each node that ran and in what order. You should see three Call n8n Workflow Tool executions, one for each sub-agent. Click into any of them to see the inputs and outputs that flowed through that agent.

Compare this to the single-agent output from Step 2. The multi-agent version produces content grounded in real search results, structured by a dedicated writer, and reviewed by a dedicated critic.

Only one or two agents fired?

Check your orchestrator's system prompt. If it still references only the Researcher, the agent does not know about the Writer and Critic tools. Make sure you replaced the entire prompt with the updated version that lists all three steps.

Also verify each Call n8n Workflow Tool has a clear, distinct Description field. The agent reads these descriptions to decide which tool to call. Vague or missing descriptions cause the agent to skip tools.

Help me figure out why my orchestrator is not calling all three sub-agents.

You now have a fully operational multi-agent content pipeline. Three specialized agents collaborate autonomously to produce output that is researched, well-written, and critically reviewed.

Secret mission

Add a Revision Loop with Guardrails

Your orchestrator runs one pass of critique and calls it done. But what if the first draft is not good enough? Add a revision loop where the Critic can reject a draft and send it back to the Writer, with guardrails to prevent the loop from running forever.

Clean Up Your Resources

Clean Up Your Resources

Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project runs on your local machine via Docker Compose, and your OpenRouter free tier incurs no charges unless you manually add credits.

Resources you used:

  • n8n and SearXNG Docker containers running via Docker Compose.
  • n8n_data Docker volume storing all your n8n workflows and settings.
  • Local project files: compose.yml and searxng-settings.yml.

Keep everything running

No action needed. Choose this if you are still actively building or experimenting with your agent workflows.

  • n8n and SearXNG use minimal resources when idle. Your four workflows (Orchestrator, Researcher Agent, Writer Agent, Critic Agent) persist in the n8n_data Docker volume.
  • Your OpenRouter account remains active on the free tier with 50 requests per day. No charges apply unless you add credits for pay-as-you-go models.

Pause - I'll come back to this later

Stop the containers to free up system resources without deleting any data. Your workflows and settings are preserved in the Docker volume.

  • In your terminal, navigate to the folder containing your compose.yml and run:
docker compose stop
  • When you are ready to resume, run this from the same folder:
docker compose start
  • n8n will be available again at http://localhost:5678 with all your workflows intact.

Delete - I don't want to use this again

Remove all Docker containers, volumes, and project files. This permanently deletes your n8n workflows and all stored data.

  • In your terminal, navigate to the folder containing your compose.yml and stop all containers plus remove volumes by running:
docker compose down -v

What does this command do?

docker compose down -v stops and removes all containers defined in your compose.yml. The -v flag also removes Docker volumes, which deletes the n8n_data volume and all workflows stored in it.

  • Delete your project folder from your Desktop by running:

macOS

cd ~/Desktop
rm -rf [[PROJECT_FOLDER="your project folder name"]]

Windows

cd ~\Desktop
Remove-Item -Recurse -Force [[PROJECT_FOLDER="your project folder name"]]
  • Confirm the folder is gone by running ls on your Desktop. Your project folder should no longer appear in the output.

That's a Wrap!

That's a Wrap!

Nice work! You just built a fully operational AI content team in n8n: an orchestrator that autonomously delegates to a Researcher, Writer, and Critic, then assembles their output into a polished deliverable.

Here's what you learned:

  • Built a multi-agent orchestrator that delegates research, writing, and critique to three specialized sub-workflows, each with its own focused persona, prompt, and tools.
  • Used the sub-workflow-as-tool pattern with the Call n8n Workflow Tool node and typed inputs via $fromAI(), the official n8n pattern for multi-agent orchestration.
  • Wired SearXNG as a free, self-hosted search backend and experienced firsthand why separation of concerns beats a single-prompt approach. Your multi-agent version produced researched, drafted, and critiqued content instead of hallucinated guesses.
  • Secret Mission: Added a revision loop where the Critic can reject a draft and trigger rewrites, with max-iteration guardrails to prevent runaway loops.

Ready to quiz yourself?