Rung 2 — visual orchestrators (n8n)
Draw the lead router as nine nodes with a branch, a loop, an error branch and a Wait node, and cost its model calls at about $2 a month.
On this page
A visual orchestrator draws a task as a graph of nodes on a canvas: branches, loops, an error branch, a node that waits, and a code node where a rule is easier written than drawn. It keeps most of rung 1's speed and removes two of its four ceilings, because the workflow is a JSON file you can commit and diff, and it can run on a server you host. The agency's lead router is nine nodes on this rung, and its model calls cost about $2 a month.
The router as nine nodes
The router does the task from scripts, workflows and agents: read a lead from any of the three sources, find the customer, and on exactly one match send a drafted reply; anything else goes to a person. The role it fills, written out in the virtual employee frame, says every lead is done within 5 minutes and that the person queue is seen within 15. Nine nodes do it:
- Webhook. One URL; the two forms post to it and the general inbox forwards to it.
- Normalise. Maps three payload shapes onto one: name, email, company, message, source. Lower-cases the email.
- CRM lookup. Finds the customer by email, retries a failed call three times, then sends the lead out of its error output to node 7.
- One match? An If node. Exactly one customer goes on; none or several go to node 7.
- Draft reply. The only model node: one call, with the form and the record in hand.
- Send reply. Sends from the sales inbox, copying the CRM's logging address so the reply lands on the row.
- Person queue. Posts the lead and the reason ("no match", "two matches", "CRM error") to the account managers' channel.
- Wait. Fifteen minutes.
- Claimed? If nobody has taken the lead, loops back to node 7, which re-posts and tags the founder, twice at most.
Eight of the nine nodes are deterministic, and the graph, not the model, decides what runs next, which is what makes the cost a single multiplication.
The primitives, as the documentation names them
Branches are the If node for a yes or no and the Switch node for several routes (Split with conditionals (opens in a new tab)). Loops come in two kinds in n8n: most nodes already run once per item, and an explicit loop connects a node's output back to an earlier node, with an If deciding when to stop (Loop (opens in a new tab)). Node 9's path back to node 7 is an explicit loop, and its stop condition, two re-posts, is written in the node rather than hoped for.
The error branch has two layers in n8n. A node's settings can retry on failure and send a final failure out of an error output instead of stopping the workflow (Work with nodes (opens in a new tab)). A workflow can also name an error workflow, which starts with an Error Trigger node (Handle errors gracefully (opens in a new tab)). The router uses both: node 3's error output queues the lead, and the error workflow pages the owner, because an unreachable CRM stops every lead behind it.
The Wait node in n8n resumes after an interval, at a set time, on a webhook call or when a form is submitted, and it saves a long wait to the database rather than holding it in memory (Wait (opens in a new tab)). Node 8 is the short case; the same node can hold a draft until a person approves it, the gate approval gates designs.
Self-hosting and the repository are the two ceilings this rung removes. n8n runs on your own server, with Docker Compose recommended for production (Host n8n (opens in a new tab)), so lead data stays on a machine you control until the one call to the model provider. Every workflow exports as JSON (Export and import (opens in a new tab)), and that file, committed after each change, is the diff rung 1 lacked. The same page warns that an export carries credential names, so read it before sharing it.
What the router costs to run
The model call's input is the 1,200-token system prompt (services, tone, what never to promise, three example replies), the form at about 250 tokens and the customer record at about 250: 1,700 tokens. The reply is about 250 tokens out. Price all 400 leads as an upper bound, as module 0 did, at the course's assumed large-model prices:
input 400 × 1,700 = 680,000 tokens × $2 per million = $1.36
output 400 × 250 = 100,000 tokens × $8 per million = $0.80
model calls per month ≈ $2.16
Only the 360 leads with one match reach node 5, so the real figure is about $1.94: $2 either way. The two sums from how to use this course put the rest beside it: $20 a month for the platform, 8 hours of people at $30 (40 queued leads at 6 minutes and, at launch, 80 sampled replies at 3), and a 12-hour build at the founder's $100. That is $262 a month against $2,000 for a person, and a $1,200 build that pays back in 0.7 months. The model calls stay under 1% of the monthly cost because the graph sends exactly one call per matched lead.
The mistake: the prompt is a string inside node 5
The prompt lives in the model node's settings, so it gets edited in the canvas. In month two the founder added two lines about retainer pricing and, in the same edit, deleted "never promise a delivery date". Nothing failed. Replies went out at about 12 a day, and a sampled one promising "live in three weeks" surfaced on day four: 48 replies had gone out on the edited prompt, and nobody could say what the previous version said.
Rung 2 does not prevent this, but it makes it findable. Export and commit after every change, so the commit shows the deleted line. Put a code node between nodes 5 and 6 that sends any draft containing a price or a date to the queue, because a rule that must hold every time belongs in a check, not a sentence. And name a reviewer for prompt changes, as the role's manager field requires.
What rung 2 still lacks is a test that runs before a change goes live, and state with a declared type; the graph's data is JSON items any node can reshape. A team that needs those has reached rung 3, and one idea, two skins maps the two node for node.
In practice
Tell the team the canvas is not the source of truth; the committed JSON file is, and a change nobody exported did not happen as far as a reviewer is concerned. Every loop states its stop condition in a node, and every rule that must always hold is a code node, not a line in the prompt.
The mistake that costs money is editing the live workflow in the canvas with no export before and after. When the replies go wrong there is no earlier version to compare against, and every day it takes to notice is another day of replies sent on the broken prompt.
Check yourself
1. Leads double to 800 a month and the system prompt grows to 2,400 tokens with more examples. What do the model calls cost now?
Input per call is 2,400 + 250 + 250 = 2,900 tokens. 800 × 2,900 = 2.32 million × $2 = $4.64; 800 × 250 = 0.2 million × $8 = $1.60. About $6.24 a month as an upper bound, against $4,000 for a person. The rung does not change; the people line, now 16 hours a month, is what grows.
2. A client contract says lead data may pass through no processor the client has not approved, and the client has approved only the model provider. Does that change the rung?
It rules out rung 1, whose chains run in the vendor's cloud, and favours a self-hosted rung 2: the router runs on the agency's server and sends one call per matched lead to the approved provider. Check what that call carries first: the form and the customer record, the data map module 8 draws.
3. The router has grown to 34 nodes and two people edit it. Last quarter three edits each broke a path for about a day. Move to rung 3?
Price it. Three breaks of a day each is about 3 × 13 = 40 leads a quarter handled late. A rebuild as code with tests is roughly 20 founder hours, $2,000. If someone on the team writes Python and the breaks are the kind a unit test catches, such as a renamed field or a deleted rule, move. If nobody can maintain code, stay on rung 2 and add the code-node checks first.