ModulesLabQuizAll courses

Multi-Step and Multi-Agent Workflows

Chain agents together only where it pays, cap the loops, and recognise an always-on personal agent when you see one.

Module 9 of 14 · Day 5 · Session 9 · AI Administrator: Agentic Workflows & Automation

Module 09 ~50 min read + lab No code

What you will learn

Prerequisites: Module 8: Building Your First Agent. Your Ops Desk assistant workflow should be working.

1. Three shapes of multi-step work

Once a single AI step or agent works, the temptation is to add more. Three shapes cover nearly every case, and each maps to a way of organising people that you already know.

Sequential: three boxes in a row; parallel: five trackers fanning out to three summarisers and a Merge box; supervisor: an AI Agent box routing to scheduling, suppliers and reporting; a table of when to pick each
The three shapes, and what each looks like in n8n: nodes in a row; branches into a Merge node; an AI Agent whose tools are other workflows.

Sequential

An assembly line. Extract the fields, then classify, then draft. Each step gets the previous output. Easiest to test and log; slowest if the steps are heavy.

Parallel

Fan out, then merge. Three summarisers each read one tracker at the same time, and a fourth step combines them. Faster, and each part can use a different model.

Supervisor

A manager agent reads the request and hands it to a specialist: scheduling, suppliers, reporting. Flexible, but the supervisor is another model call that can misroute.

Office taskShapeWhy
Invoice to approved payment fileSequentialEvery invoice takes the same steps in the same order
Weekly report from five project trackersParallelTrackers are independent; summarise them at once, then merge
A department chat desk that handles scheduling, suppliers and reportsSupervisorThe request type is not known until it is read

In n8n the shapes are literal: sequential is nodes in a row, parallel is branches into a Merge node, supervisor is an AI Agent whose tools are other workflows.

2. The critic-and-revision loop

The most useful two-agent pattern in office work is the writer and critic. One step drafts; a second step, with a different prompt and ideally a different model, checks the draft against a checklist and either approves it or returns specific fixes; the writer revises. It is a code review for text.

A form, a counter set to zero, a Writer, a Critic on another model, a Review log, an IF Approved leading to a Gmail draft, otherwise a counter plus one and an IF revision at most two looping back to the Writer or e-mailing a person
The writer-and-critic loop as nodes: a counter, two chains on two models, a log, two decisions, and one connector back. The critic's six checks live in its prompt; its answer is always APPROVED or REVISE with numbered points.

What the critic checks is whatever you would check: facts match the source, tone matches policy, nothing promised that we cannot deliver, no personal data, under the word limit. Write the checklist into the critic's prompt and make it answer in a fixed form: APPROVED or REVISE: followed by numbered points.

Cap the loop

Two agents can disagree forever, and each round costs money. Set a hard maximum, two revisions is typical, and route to a person when the cap is reached. In n8n the cap is a counter field incremented on each pass and checked by an IF node before looping back. Module 10 treats the cap as a formal control.

A critic loop with a cap of two roughly triples the cost of a draft step. Use it where the reader is a customer, a regulator or the board; not for internal reminders.

3. Hand-offs, and the two protocols

When one agent passes work to another, the hand-off should carry three things: the task in one sentence, the facts gathered so far, and the constraints (deadline, tone, what not to do). Anything not passed is lost; the next agent does not see the previous conversation unless you send it. Passing everything is expensive and confusing; pass a summary plus the raw items that matter.

Agent A hands Agent B three things: the task, the facts so far, the constraints; passing everything versus passing a summary plus the raw items that matter
A hand-off carries the task, the facts and the constraints; anything not passed is lost. In the lab this is literal: a chain outputs only its text, and a Sheets node only the row it wrote.

MCP (Model Context Protocol, Module 7) standardises how an agent talks to tools and data: one plug for CRMs, calendars and files. A2A (Agent-to-Agent) standardises how an agent talks to another agent, possibly from a different vendor: how it announces what it can do, how a task is handed over, and how progress and results are reported back. In short, MCP is the agent's hands; A2A is the agent's colleagues. For an administrator, both mean one thing: the supplier's agent and yours can be made to cooperate without a bespoke integration project.

Your agent in the middle; MCP arrows to calendar, CRM, policy files and the supplier sheet on the left; A2A arrows to the supplier's ordering agent, HR's leave agent and a vendor's support agent on the right
MCP is the agent's hands; A2A is the agent's colleagues. The questions for an administrator stay the same: what data crosses, who approved it, where is the log.

4. When multi-agent is overkill

Multi-agent designs are fashionable, and most of them should be one good prompt. Add a second agent only when at least one of these is true:

DesignModel calls per itemTypical latencyFailure points
Single AI step12 to 5 seconds1
Sequential, three steps36 to 15 seconds3
Writer + critic, cap 23 to 510 to 30 seconds3, plus the loop
Supervisor + three specialists2 to 610 to 40 secondsMisrouting, plus each specialist

Every extra agent is another prompt to maintain, another log to read and another place for something to go wrong. Count the calls and the failure points before you draw the diagram.

5. Demo A: the loop on three cases

Everything below was built and tested on n8n Cloud (2.43.6) on 21 October 2026: the writer is Gemini 2.5 Flash and the critic Gemini 2.5 Pro, both on the trial's Gateway credits, temperature 0. AI Caravan Ltd., its suppliers and its staff are fictional.

n8n canvas: Supplier email with review form, Start, Writer with Gemini (writer), Keep draft, Critic with Gemini (critic), Verdict, Review log, Approved?, Gmail (create draft), Next revision, Under the cap?, Gmail (escalate to a person), and a connector from Under the cap? back to the Writer
The finished loop. Read it left to right; the long connector back to the Writer is the loop. Two IF nodes, one counter, one log.
The n8n form: Supplier, Supplier email, Your email, Purpose of email, Key facts, Deadline
The form that starts it: a form instead of a chat, so every run is repeatable and comparable. "Your email" is where an escalation goes.
Video, recorded live: the finished loop node by node: the counter, the Writer, the first hand-off, the Critic on a stronger model, the Verdict and the Review log, the two decisions (narrated, with captions).
CasePassesVerdictsWhere it ended
1 Simple: Northwind, the 2027 price list, three facts, deadline given1APPROVEDA Gmail draft to the supplier, unsent
2 Tempting: ask Omar to call Sara back; Sara's mobile number is in the facts2REVISE: 5 (the mobile number), then APPROVEDA Gmail draft, without the number
3 Impossible: promise payment on 30 October; no date has been approved3REVISE: 2 against 6, three timesThe escalation e-mail with the last draft and the critic's points

Case 2 is the lesson of the independent check: the writer was never told "no phone numbers"; the critic was. Case 3 is the lesson of the cap: a promise the facts forbid can never pass check 2 and check 6 at once, so the two models would argue forever. After two revisions a person reads both verdicts and decides. The critic's last words on case 3: "The purpose and the facts are in conflict. You must get the payment date approved by Finance before you can send an email promising it."

The Review log sheet with six rows: timestamp, supplier, revision, verdict, draft; two APPROVED in green, four REVISE in red
The Review log after the three cases, rendered from the six rows the workflow appended: one row per pass. This is the audit trail Module 10 will ask for.
The escalation e-mail: subject Needs a human: supplier email to Tailspin Catering (3 revisions); body with the purpose, the facts, the last draft and the critic's last verdict
What the person receives when the cap is reached: the purpose, the facts, the last draft and the critic's last verdict. Nothing went to the supplier.
Video, recorded live: case 1 submitted on the form and watched in the Executions tab; the verdicts of cases 2 and 3; the escalation node and the Review log (narrated, with captions).

5b. Demo B: always-on personal agents

Everything so far runs inside a workflow you trigger. A newer category runs all the time as a service on a server or laptop, and you talk to it on the messaging app you already use. Two open-source examples are widely used in 2026: Hermes Agent (Nous Research: persistent memory in layers, twenty-plus messaging platforms through one gateway, skills it writes for itself) and OpenClaw (MIT licence; capabilities as skill folders with a SKILL.md, installable from a public marketplace called ClawHub; a Docker sandbox that is off by default). Your instructor demonstrates them live from his own laptop. This section is for recognition, not for building.

Two columns: personal always-on agent (runs all the time, deep personal memory, broad tools, one trusted person, a persona file) versus the shared department desk of Module 8 (triggered, short per-user memory, narrow read-or-draft tools, a whole department, a five-part system prompt)
Same four parts, opposite settings. The memory is deep and personal and the tools are broad: powerful for one person, unsuitable for a shared department desk, which is why Module 8's memory advice was the opposite.
BeatOn the phone or in the terminalWhat to notice
1 Memory in"Remember: I like e-mails under 100 words, and my supplier files are in aicaravan-demo"It confirms and says it saved a note
2 Files"List my supplier files and summarise the Northwind notes in three lines"It names the tool it used and reads the file
3 Shell"How many rows are in suppliers.csv?"It runs a command on the laptop: 5 suppliers
4 Behind the scenescat ~/.hermes/memories/MEMORY.md, ls ~/.hermes/skillsIts own notes about you; the skill folders it learns into
5 New session/new, then "What do you know about me?"It still knows: memory survives the session
6 OpenClawopenclaw agent --local -m "...", then the workspace folderSame category, a different tool: SOUL.md, AGENTS.md, USER.md
Telegram chat with the Hermes bot: files found in aicaravan-demo, a three-line summary of the Northwind notes, and I read suppliers.csv: there are 5 supplier rows
Beats 2 and 3 on Telegram (the course author's own chat with Hermes Agent v0.22.3 on his laptop, 21 October 2026): the file tool, then a shell command.
Telegram chat after /new: Here is what I know: you are Abdulkarim, heading Finance Operations at AI Caravan Ltd.; you prefer e-mails under 100 words; your working directory is aicaravan-demo; suppliers.csv contains 5 supplier records
Beat 5: after /new the agent still knows who you are, what you prefer and what is in each file. The approval prompt above it is Hermes asking before a shell command: a control only the owner sees.
A terminal: cat of MEMORY.md and USER.md showing the two remembered facts, ls of twelve skill folders, hermes status
Beat 4, rendered from the real command output: the memory files Hermes wrote about its user, and the skill folders.
A terminal: openclaw agent --local listing the workspace files and counting five supplier rows; the head of SOUL.md; the sandbox setting unset
Beat 6, rendered from the real command output: OpenClaw's embedded agent on the same four files; its workspace holds SOUL.md, AGENTS.md, IDENTITY.md and USER.md; the sandbox setting is unset, so the runtime default applies.
Video, recorded live in a terminal: the six beats with Hermes Agent and OpenClaw running on the author's laptop (narrated, with captions).

Do not install these unsupervised

Both tools need a server or a laptop that stays on, API keys and broad permissions, and both have had real security incidents: malicious skills in the OpenClaw marketplace that stole API keys and rewrote the agent's memory files, and sandbox escapes fixed in later releases. They are shown here so you can recognise the category and ask the right questions. Module 11 uses the OpenClaw incidents as a case study in agent security and supply-chain controls. If your organisation wants an always-on agent, that is an IT and security project, not a lab exercise.

Practical lab

You will extend Module 8 into a writer, critic, reviser chain for supplier e-mails in n8n. The writer drafts from a form; the critic, on a different and stronger model, checks the draft against six rules and returns APPROVED or numbered fixes; the writer revises, at most twice; every pass is logged to a Google Sheet; an approved draft lands in Gmail Drafts for a person to send, and anything still not approved after two revisions goes to a person by e-mail. Every setting below was verified on n8n Cloud 2.43.6 on 21 October 2026; the three trap boxes are what went wrong on the way.

Files for this lab

1

Start from a form

New workflow M9 Supplier email with review; workflow menu, Settings, Timezone yours. First step On form submission with six fields in this order: Supplier (text), Supplier email (email), Your email (email: where an escalation goes), Purpose of email (textarea), Key facts (textarea), Deadline (text, not required). The form replaces the chat so every run is repeatable.

2

Add the counter

An Edit Fields (Set) node, rename it Start, Include Other Input Fields off. Nine fields: supplier, supplier_email, your_email, purpose, facts, deadline from the form values ({{ $json['Supplier'] }} and so on), revision as a Number with value 0, and feedback and draft empty. The counter is your loop cap.

Trap 1: the counter is a Number

In every Edit Fields node that sets revision (Start, Keep draft, Verdict, Next revision) the type must be Number. As a String, revision 0 + 1 becomes "01", then "011", and the cap of 2 is never reached: the loop runs until n8n stops it.

3

Add the writer

A Basic LLM Chain, rename it Writer. Prompt: Define below, paste the Writer prompt from the prompt sheet; the braces must turn green (Expression mode). Under Model: Google Gemini Chat Model, Gateway credits, models/gemini-2.5-flash, temperature 0.

Write a professional email to the supplier below on behalf of the Finance team of AI Caravan Ltd. Use only the facts given. Do not promise payment dates or amounts not listed. Under 150 words. Sign off as "Finance Operations". If reviewer feedback is present, revise the previous draft to address every numbered point. Reply with the email body only: no subject line, no commentary. Supplier: {{ $json.supplier }} Purpose: {{ $json.purpose }} Facts: {{ $json.facts }} Deadline: {{ $json.deadline || 'none given' }} Reviewer feedback: {{ $json.feedback || 'none' }} Previous draft: {{ $json.draft || 'none' }}
4

Keep the draft (the first hand-off)

The chain outputs only text. Add an Edit Fields node, rename it Keep draft, Include Other Input Fields off: the six fields from {{ $('Start').item.json.supplier }} and so on; revision (Number) = {{ $('Next revision').isExecuted ? $('Next revision').item.json.revision : 0 }}; feedback = {{ $('Next revision').isExecuted ? $('Next revision').item.json.feedback : '' }}; draft = {{ $json.text.trim() }}. The two guards read "on the first pass there is no Next revision node yet".

5

Add the critic

A second Basic LLM Chain, rename it Critic, with the Critic prompt below. Under Model: Google Gemini Chat Model, Gateway credits, models/gemini-2.5-pro, temperature 0. A different and stronger model than the writer: the check must not share the writer's assumptions, and a weak critic invents faults.

You review outgoing supplier emails for the Finance team. Check the draft against this list: 1. Uses only the facts provided; nothing invented. 2. No payment date or amount promised unless in the facts. 3. Polite, professional, under 150 words. 4. Mentions the deadline if one was given. 5. No phone numbers, home addresses or other personal data; naming the people involved is fine. 6. Does what the purpose asks; an email that avoids the task is not finished. Reply with exactly APPROVED if all six pass. Otherwise reply with REVISE: followed by numbered points, each naming the failing item and the fix. Purpose of the email (the task the writer was given): {{ $json.purpose }} Facts: {{ $json.facts }} Deadline: {{ $json.deadline || 'none given' }} Draft: {{ $json.draft }}

Trap 2: a critic that cannot be trusted

Three critic prompts failed before this one. Without the purpose line, the critic judged the task itself as invented ("the draft requests the 2027 price list, which is not in the facts"). Without check 6, it approved an e-mail that simply left the impossible promise out. And on a cheap model (Gemini 2.5 Flash-Lite) it invented faults on the second pass and sent a fixable draft to escalation. A hand-off must carry the task; the strong model belongs on the reviewer side.

6

Record the verdict (the second hand-off)

An Edit Fields node, rename it Verdict, Include Other Input Fields off: verdict = {{ $json.text.trim() }}, timestamp = {{ $now.toFormat('yyyy-MM-dd HH:mm:ss') }}, the seven carried fields (supplier ... draft) from {{ $('Keep draft').item.json... }}, and revision as a Number from the same node.

7

Log every pass

A Google Sheets node, Append Row in Sheet: Document and Sheet From list, Review log; map the columns timestamp, supplier, revision, verdict, draft; Options, Cell Format: RAW. This is the audit trail Module 10 will ask you for.

Trap 3: the Sheets node outputs the row it wrote

After Append Row, $json holds the five columns of the row and nothing else. Our first escalation went to an empty address and failed with "The email address '' in the 'To' field isn't valid", and the draft nodes had silently created drafts with no recipient before that. Every node after the Review log reads its fields from the Verdict node: $('Verdict').item.json.supplier_email, and so on.

8

Decide

An IF node, rename it Approved?: {{ $('Verdict').item.json.verdict }} String, starts with APPROVED. True branch: Gmail, Create a draft: To (under Options) {{ $('Verdict').item.json.supplier_email }}, Subject AI Caravan Ltd. Finance: {{ $('Verdict').item.json.purpose.slice(0, 60) }}, Message {{ $('Verdict').item.json.draft }}. A draft, not Send: a person reads it in Gmail and clicks send. False branch: an Edit Fields node, rename it Next revision: the seven carried fields from $('Verdict'), revision (Number) = {{ $('Verdict').item.json.revision + 1 }}, feedback = {{ $('Verdict').item.json.verdict }}.

9

Loop, and cap

A second IF node, rename it Under the cap?: {{ $json.revision }} Number, is less than or equal to 2. True: drag the connector back to the Writer node's input; the canvas now shows a loop, and the Writer reads feedback and draft from its input. False: Gmail, Send a message to {{ $json.your_email }} with the subject "Needs a human: supplier email to {{ $json.supplier }}" and the purpose, the facts, the last draft and the critic's points in the body. Save, then Execute workflow: n8n opens the test form in a new tab and waits (if the browser blocked the popup, Publish and use the trigger node's Production URL).

10

Run three cases

Submit the form three times with the rows of the test-cases sheet: a simple request (Northwind, the 2027 price list: should approve on the first pass), a tempting one (ask Omar at Contoso to call Sara back, with Sara's mobile number in the facts: one revision, then approved without the number), and an impossible one (promise Tailspin payment on 30 October when no date has been approved: three REVISE verdicts, then the escalation e-mail in your inbox). Check that the Review log shows every pass: six rows, one escalation, two drafts. The wording of the critic's points differs between runs; the paths do not.

Video, recorded live: the loop node by node, as a walkthrough for this lab (narrated, with captions).

Deliverable

A screenshot of the loop on the canvas with the counter and both IF nodes visible, and the Review log sheet showing at least five rows across the three cases, including one escalation, plus the exported workflow JSON. Save as M9-writer-critic. Session 10 wraps this loop in approvals and a human-in-the-loop step, so keep it working.

Knowledge check

Pick one answer per question, then check your score. These mirror the style of the final exam.

1. Which shape fits 'summarise five independent project trackers into one report'?

Why: The trackers are independent, so summarise them at the same time and combine the results.

2. What must every critic-and-revision loop have?

Why: Two agents can disagree indefinitely; the cap bounds cost and hands unresolved cases to a human.

3. In one sentence, what does A2A standardise?

Why: MCP covers tools and data; A2A covers agent-to-agent cooperation across vendors.

4. Which is a good reason to split a task across two agents?

Why: Least privilege, different models, independent checking and parallelism are the legitimate reasons; fashion is not.

5. Why are OpenClaw and Hermes shown as a demo rather than a lab?

Why: They are powerful personal agents whose deployment is an IT and security project. Module 11 uses their incidents as a case study.

Self-check

Answer in your own words first, then open the model answer.

1. Describe an office process for each of the three shapes and say what the n8n node structure would look like.

Sequential: nodes in a row (invoice extract, classify, draft). Parallel: branches into a Merge node (tracker summaries). Supervisor: an AI Agent whose tools are other workflows (department desk).

2. What three things should a hand-off between agents carry?

The task in one sentence, the facts gathered so far, and the constraints such as deadline, tone and prohibited actions.

3. What is the key design difference between a personal always-on agent and a shared department assistant?

Personal agents have deep, persistent memory and broad tools for one trusted user; shared assistants need per-user, short-window memory and narrow, mostly read-only tools.

Summary

Key takeaways

  • Sequential, parallel and supervisor are the three shapes; in n8n they are a row, branches into Merge, and an agent whose tools are workflows.
  • The writer-and-critic loop is code review for text: fixed verdict format, hard revision cap, human route when the cap is hit.
  • Hand-offs carry task, facts and constraints. MCP is the agent's hands; A2A is the agent's colleagues.
  • Add agents only for least privilege, different models, independent checks or parallelism; count calls and failure points first.
  • OpenClaw and Hermes are always-on personal agents: recognise the category, and treat deployment as an IT and security project.

Further reading: Agent-to-Agent Protocols · Model Context Protocol · LangGraph: agents as graphs · OpenManus multi-agent architecture