Rules of the mail case, for your team and your coding agent

On this page

For your coding agent: this button copies the whole page as plain text (Markdown). Paste it at the start of a chat, or save it in your team's folder as AGENTS.md. Fill in your team's spec at the end of this page first: then the copy carries it too.

This page is a template for your own rules. The rules hold for every system you build with Langflow and n8n. The examples come from the mail case of Workshop II: they show what each rule looks like when it is built, and they are marked as examples everywhere. Your own names, tables and flows take their place: the form at the end writes them in the same words.

Six principles to align your team around

Principle Example: the mail case
1 One task per piece. Each Langflow flow does one job: sort, write, or check. A small piece is easy to test and easy to swap. The Langflow flow Triage sorts. Draft Reply writes. Check Draft checks. The n8n workflow WS2.3 passes the mail along.
2 Make a contract about what goes in, what comes out. Each Langflow flow takes a fixed input and gives a fixed answer: which fields, which values. Write it down before you build. Triage returns action and checks_ok. WS2.3 reads exactly these.
3 One place for the data. The mails, the search and what was done already live in one database. Every tool reads it. Nothing is copied, nothing runs twice. PostgresDB holds the mails, the search (chunks) and the table processed. The mail service writes the mails, n8n writes the search entries and processed, Langflow reads.
4 What a rule decides, what the model decides. The model proposes. A fixed, testable rule decides what happens, the same every time. Anything unknown goes to a person. A confidential mail (a tag on the mail in the database, not the model's opinion) gets a label, never a draft. An unknown action goes to a person.
5 What each part may do. Each part gets only what its job needs. The database enforces it, not a prompt. The agent cannot send. Draft Reply's login never sees a confidential mail. Only approve() moves a reply on.
6 Where a person decides. Nothing leaves without an OK. The system waits. In WS2.4 the draft waits on a form until you approve.

Names

The pattern first, then an example from the mail case; your team's name takes the place of WS2.<step>.

Every workflow carries a note

A sticky note at the top of the canvas, so that a teammate, your coding agent, or you in three weeks can read the workflow without opening a node. The pattern first, then the mail case:

Example: the note of WS2.3 - Triage New Mail starts with Created by: Frank Huettner · Date: 31 Oct 2026 · Part of: Workshop II, step 3: 9 Nov · Tags: WS2, mail case, 9 Nov, then says in four sentences what the workflow does, the fixed rule included: a confidential mail gets no draft, only the label.

Contracts between the pieces

Example: two answers of Triage, as its contract allows them:

{"action": "calendar", "events": ["Request_Meeting"], "deadline": "Friday at 2 pm",
 "why": "Lara asks for a meeting.", "checks_ok": true, "problems": []}
{"action": null, "events": [], "deadline": "", "why": "", "checks_ok": false,
 "problems": ["not one JSON object: I think this is a reply."]}

How n8n calls a Langflow flow

This holds for every Langflow flow; the names are the mail case's.

What each part may do

The database has one login per part. Each login may do only what that part needs. This is principle 5, enforced by PostgresDB, not by a prompt. The table is the mail case's; your system has its own parts and logins.

Part (example: the mail case) Login May
The mail service (kingo-pod's part called Mail) n8n_workshop_mail_container write the mails into messages; send what is in outbox once it is approved; do in Gmail what changes asks
n8n n8n_workshop_mail_n8n read mails; insert into outbox (a proposal, never a sent mail) and changes (a label, an archive); claim mails in processed; keep the search up to date (chunks); keep test cases and results; run approve() and reject()
Langflow, when it answers a question (Ask Mailbox) n8n_workshop_mail_agent read mails, processed, the search and the calendar; write nothing
Langflow, when it drafts a reply (Draft Reply) n8n_workshop_mail_reply read the search and the calendar only, no mailbox rows; the database hides every confidential entry from it. The date limit is Mail Search's own: it reads only mails up to the date of the mail it answers

Also, in the mail case:

Who decides: a rule, the model, or a person

The five checks (Yanbo's trust components)

Ask these about your own system. The mail case's answers are the examples in the second column.

Check Example: the mail case
Input validation: what reaches the model, and what is masked or kept out? WS2.3 masks personal numbers; a mail that tries to instruct the assistant goes to a person. WS2.4 masks again before Draft Reply.
Process guardrails: what may each part do, and who enforces it? Langflow may only read. The database decides which entries each login sees. Only approve() moves a reply on.
Output filter: is every answer checked before anything acts on it? Check Triage (a known action), Check Draft (no placeholder, the right greeting, addresses and numbers only from the mail or its sources, at least one source). n8n acts on a triage only if its check did not say no; a draft goes to the form with its verdict.
Error handling: what happens when a call fails or an answer is bad? n8n calls Langflow up to twice. A triage that is not valid, or failed its check: the mail goes to a person. A draft that failed its check: the problems are shown on the form. A call that fails both times stops the run with an error; the Error Workflow of 16 November gives such mails back.
Audit trail: can you show every run and every decision later? n8n's Executions: every run that decides something, node by node. The approvals page only shows, so it keeps only its failed runs. outbox: proposed → approved → sent, with who approved, when, and why.

Four things to know about n8n

They hold for n8n 2.41, the version in kingo-pod, and each one has cost someone in this course an hour.

Measure before you believe

Three checks before you build on

From n8n's own course In Practice: AI, Testing & Best Practices; they match what breaks most often in this room.

  1. Name everything clearly. Workflows, nodes, tables, credentials, as in Names above. A name is the first test of a design: if you cannot name a node by what it does, it does two things.
  2. Add error handling before you go live, not after something breaks. Every call to a model or an API gets a retry and a path for the answer that is wrong or missing. Example: n8n calls Langflow up to twice; a triage that is not valid goes to a person.
  3. Use built-in nodes before Code. An IF, a Switch, a Set or a Filter is visible and testable; a Code node hides its logic. Code only where no node does the job.

Your team's spec: the six principles, for your own system

Fill this in before you build on. Then Copy as Markdown and give it to your coding agent, together with the rules above, or Download it as team_spec.md into your team's folder. The form keeps your text in this browser.

One row per piece: a Langflow flow, an n8n workflow, or something else. Name it as the rules say.

Piece (its name)ToolIts one taskWhat goes inWhat comes out

Where the data lives, which tables, who writes and who reads.

The rules first (fixed, testable), then what the model proposes. Where does anything unknown go?

Per part: read, write, send? Who enforces it?

Which step waits for an OK, and who gives it.

Agentic AI in Business · Workshop II · Frank Huettner · SKK GSB.