MFT & Middleware · IA & Automatisation · Architecture · Retour d'expérience

J'ai automatisé la rotation des clés SFTP
avec n8n, Claude AI et une architecture multi-agents.

65 partenaires. Une rotation par partenaire, chaque année. Une politique RSSI qui ne transige pas. Et une équipe MFT qui fait tout ça à la main — 4h de rotation technique, plus tout ce qui gravite autour. J'ai exploré si on pouvait automatiser ça avec n8n et Claude AI en gardant l'humain aux bons endroits. Voici l'architecture complète, les prompts système, et ce que j'ai appris.

Photo de profil
Ismail Bouchkhi
Consultant Expert MFT · Middleware & Automatisation · Paris
Fév 2026  ·  18 min de lecture
"Une rotation de clé SFTP, c'est 4 heures de travail technique : génération, déploiement, tests, supervision. Mais autour de ces 4 heures, il y a des emails à rédiger, des confirmations à attendre, des relances à envoyer, des statuts à mettre à jour. Personne ne compte vraiment ce temps-là. Quand on le fait, on réalise que le vrai coût n'est pas dans la rotation — il est dans l'orchestration."
SSH key rotation logs sur écrans de supervision — salle serveur
La rotation des clés SSH en production : des logs qui défilent, des statuts partenaires qui se mettent à jour — ce que j'ai automatisé avec n8n et Claude AI.

Le problème à 650 heures par an

Dans la plupart des entreprises qui opèrent une plateforme MFT de taille significative — disons 50 à 100 partenaires actifs — la gouvernance des clés SFTP est gérée manuellement. Pas par choix. Par habitude héritée. Et parce que personne n'a jamais mesuré ce que ça coûte vraiment.

La politique RSSI impose une rotation annuelle obligatoire. Sur 65 partenaires, ça fait 65 processus à orchestrer chaque année. La partie technique — génération des clés, déploiement dans Axway B2Bi, tests de connectivité, documentation — représente environ 4 heures par rotation. C'est visible, planifiable. Ce qu'on ne mesure pas, c'est tout ce qui entoure ces 4 heures : les emails aller-retour, les relances faute de réponse, les escalades vers le RSSI, les mises à jour de statut. En moyenne 6 heures supplémentaires par rotation, fragmentées sur plusieurs jours, souvent invisibles dans les bilans de charge.

65
Partenaires MFT
4h
Rotation technique
+6h
Coordination invisible
~650h
Coût annuel total

650 heures par an sur de la coordination pure — emails, relances, statuts — qui ne crée aucune valeur technique. Plus de 4 mois de travail effectif sur une tâche répétitive. Et une dépendance forte à une personne : si elle est absente pendant une rotation critique, le processus s'arrête. Il n'y a pas de mémoire système. Tout est dans les têtes et dans les emails.

Ce projet part d'une question simple : est-ce qu'on peut confier l'orchestration à une IA tout en gardant l'humain là où il compte vraiment ? Spoiler — oui. Mais pas sans quelques surprises en chemin.

Architecture multi-agents — vue d'ensemble

J'ai fait le choix de n8n comme orchestrateur pour une raison précise : la capacité à construire des sub-workflows autonomes connectés entre eux, avec une granularité de contrôle que les plateformes SaaS ne permettent pas facilement. Claude AI tourne dans chaque agent comme LLM backbone via @n8n/n8n-nodes-langchain.lmChatAnthropic.

L'architecture se compose de deux workflows principaux et quatre agents spécialisés appelés comme sub-workflows. Ce qui la rend solide : aucun agent n'agit seul. L'orchestrateur décide toujours. Les agents exécutent des tâches discrètes et remontent leur résultat — c'est une distinction fondamentale avec une architecture "agent loop" classique où l'agent prendrait ses propres décisions.

MFT_KEY_GOVERNANCE — Architecture globale
⏰ Scheduler 8h00
Déclenchement quotidien
→ Set Trigger Auto
+
📱 Telegram Trigger
Commande manuelle
Text + Voice (Whisper)
+
📧 Gmail Trigger
Réponses partenaires
Tokens HITL · Auto-reply
↓ convergent vers ↓
🤖 Orchestrateur MFT (Claude Sonnet)
Cerveau central — reçoit le contexte, décide des actions, distribue aux agents
Règles absolues · Mémoire fenêtrée · Format réponse strict
↓ appelle ↓
🔧 Technical Agent
Scan Airtable
Statuts · B2Bi sim
Logging Notes
📧 Communication Agent
Emails partenaires
Analyse réponses
Relances J+3/J+7
👤 HITL Agent
Validation double canal
Email + Telegram
Token unique
📅 Calendar Agent
Rappels J+3
Événements activation
Escalade J+7

Workflow 1 — Main Orchestrator

Le workflow principal a trois points d'entrée distincts qui convergent tous vers le même orchestrateur :

Entrée 01
⏰ Scheduler Quotidien 8h00
Un nœud scheduleTrigger se déclenche chaque matin à 8h. Le nœud Set Trigger Auto construit automatiquement le message d'entrée : "Date : [jour] — Scan automatique quotidien — vérifie toutes les clés SFTP et déclenche les actions nécessaires." L'orchestrateur repart en autonomie totale.
Entrée 02
📱 Telegram Trigger
L'équipe MFT interagit en langage naturel via Telegram. Le workflow supporte texte et messages vocaux — les recordings sont transcrits en temps réel via OpenAI Whisper avant d'être transmis à l'orchestrateur. Un Classifier LLM (Claude Haiku 4.5) détermine en amont si le message est "simple" ou "complexe".
Entrée 03
🔄 Restore Input
Entrée programmatique pour les reprises de workflow après attente — lorsque le système reprend après validation HITL ou réception d'une réponse partenaire. Permet de maintenir le contexte entre deux exécutions distinctes.

Le Classifier — simple ou complexe ?

Avant d'engager le gros orchestrateur Claude Sonnet pour chaque message Telegram, un agent léger basé sur Claude Haiku 4.5 catégorise le message en une seule valeur : "simple" ou "complexe". C'est l'un des détails architecturaux les plus fins du projet.

Classifier Agent — System Prompt
"Tu reçois un message. Réponds UNIQUEMENT par : - "simple" si c'est une salutation, question courte, remerciement, ou message ne nécessitant aucune action externe - "complexe" si c'est une demande qui nécessite d'envoyer un email, chercher des infos, gérer un agenda, faire une recherche web, accéder à des fichiers ou une base de données Ne réponds rien d'autre que "simple" ou "complexe"."

Si simple → réponse directe sans appels d'outils, latence quasi nulle. Si complexe → passage à l'orchestrateur complet avec tous ses agents. Ce pattern Classifier → Routeur réduit drastiquement les coûts d'inférence et la latence pour les interactions quotidiennes banales. Le coût d'un appel Haiku est environ 20× inférieur à un appel Sonnet — pour des dizaines d'interactions quotidiennes, ça compte.

💡

Pattern à retenir : "C'est bon pour Acme Corp ?" → réponse en 1 seconde au lieu de 8. Ce seul pattern peut justifier l'architecture à deux niveaux sur un système en production.

Workflow n8n — Orchestrateur principal avec Classifier Agent et routage Telegram
Workflow principal : Message Received → Voice or Text → Classifier Agent (Haiku) → routage Simple/Complexe → Orchestrateur MFT (Sonnet) + ses 4 agents sous-jacents.

Le HITL — validation humaine double canal

Le HITL (Human In The Loop) est la pièce maîtresse du système du point de vue sécurité. Aucune activation B2Bi ne peut se faire sans validation humaine préalable — hardcodé dans le system prompt de l'orchestrateur comme règle absolue, pas comme option. J'ai choisi une validation double canal simultanée pour maximiser la probabilité d'une réponse rapide, quel que soit le contexte où se trouve le validateur.

📧
Canal Email
Notification structurée complète — résumé de la rotation, détails du partenaire, token unique au format MFT-YYYYMMDD-HHMMSS, lien de validation direct. Le RSSI reçoit l'intégralité du contexte pour une décision éclairée.
Détection regex : /MFT-\d{8}-\d{6}/i
sur le sujet et le corps (certains clients email reformatent le sujet lors du reply)
📱
Canal Telegram
Alerte courte — max 100 caractères, sans accents pour éviter les erreurs byte offset — avec boutons inline Approuver / Refuser. Taillé pour une validation en mobilité, en quelques secondes.
Premier canal à répondre déverrouille le webhook resume. Le second est ignoré. Pas de double validation possible sur le même token.
Séquence HITL complète
HITL Agent reçoit : { partner: "Acme Corp", b2bi_id: "ACC-001", key_hash: "SHA256:..." }Email RSSI : objet: "MFT-20260225-143022 — Validation rotation Acme Corp" Telegram : "Validation en cours pour Acme Corp ACC-001"Webhook wait : workflow suspendu — attend signal resume Timeout : 24h → escalade automatiqueSi APPROUVÉ :Technical Agent : simulation B2Bi + statut "Activé" dans AirtableCommunication Agent : email confirmation au partenaireTelegram info : "✅ Acme Corp activé"Si REFUSÉ :Statut : "Bloqué RSSI" dans AirtableEmail partenaire : notification report de la rotation
⚠️

Piège rencontré en test : après validation HITL par email (token OUI), l'orchestrateur redéclenchait un HITL Telegram. Ce comportement est parfaitement logique du point de vue du LLM — "deux validations valent mieux qu'une". Mais c'est une boucle. J'ai dû l'interdire explicitement dans le system prompt.

Airtable — la source de vérité unique

Toute la gouvernance repose sur une table Airtable SFTP_Partners. C'est la mémoire persistante du système — chaque agent lit et écrit dans cette table. Aucun état n'existe en dehors d'elle. Les statuts forment un cycle strict : Nouveau → Email envoyé → En attente → Confirmé partenaire → Activé. Un statut ne peut pas régresser. L'escalade est un état terminal qui requiert intervention humaine.

MFT_KEY_GOVERNANCE · SFTP_Partners
# Partenaire Expiration Statut Email envoyé Confirmation Activation B2Bi Relances Notes échange
1 Acme Corp 15/9/2026 Nouveau 0
2 Beta Solutions 20/8/2024 En attente 2/6/2024 1 En attente de confirmation partenaire.
3 Gamma Industries 10/7/2027 Activé 25/2/2026 0 2026-02-25 — Email de confirmation reçu
4 Delta Partners 1/10/2024 Actif 4/6/20246/6/20247/6/2024 0 Processus fluide.
9 Iota Consulting 18/7/2024 Escalade 8/6/2024 3 Troisième relance. [2026-02-24] Escalade RSSI.

Quatre champs méritent une attention particulière en implémentation :

Statut
Single Select — piège connu. Airtable retourne un objet {name: "Activé"} et non une string directe. Toutes les comparaisons dans le workflow doivent utiliser .name — source du Bug #1 lors des premiers tests.
Notes échange
Long Text — journal horodaté. L'orchestrateur y appende systématiquement chaque action via Technical Agent. Aucune action sans trace. C'est la piste d'audit du système.
Nb relances
Number — trigger d'escalade. Incrémenté à chaque relance. Lorsqu'il atteint 3, l'orchestrateur passe automatiquement le partenaire en statut "Escalade" et notifie le RSSI.
Date activation B2Bi
Date — renseignée uniquement après HITL. Sa présence dans Airtable est la preuve qu'une validation humaine a bien eu lieu avant le déploiement. Pas de raccourci possible.

Workflow 2 — Gmail Trigger & Email Router

C'est le workflow le plus sophistiqué en termes de logique de filtrage. Chaque email reçu doit être catégorisé et routé vers le bon traitement — sans jamais déclencher d'action parasite sur un email interne, un auto-reply, ou un email sans lien avec le système. J'ai appris ça à la dure lors des premiers tests, où un email d'absence de bureau avait été interprété comme une confirmation partenaire.

Workflow n8n — Gmail Router avec pipeline de filtres en cascade
Gmail Router : Gmail Trigger → Filter Internal RSSI → Filter HITL Token → Filter No-reply & Auto-reply → Airtable Find Partner → Filter Known Partner → Build Orchestrator Context → Orchestrateur Email (Sonnet).
Gmail Trigger — écoute tous les emails entrants
Filter Internal RSSI — si From === [email protected] → Ignore
Filter HITL Token — si subject ou body contient /MFT-\d{8}-\d{6}/i → route validation token
Filter No-reply & Auto-reply — regex multi-critères :
→ adresse : noreply|no-reply|donotreply|mailer-daemon|postmaster
→ sujet : Auto:|Out of office|Absence du bureau|Réponse automatique
→ headers : x-autoreply ou auto-submitted présents
Airtable Find Partner — lookup par adresse email expéditeur
Filter Known Partner — si pas de résultat → Telegram alert "Unknown sender"
Build Orchestrator Context — snippet, From, Subject
🤖 Orchestrateur Email — Claude Sonnet analyse et agit

La logique de décision de l'Email Orchestrateur

Email Orchestrateur — Logique de décision
Analyse email reçu : De: {{ emailFrom }} · Objet: {{ emailSubject }} · Contenu: {{ snippet }}→ CONFIRMATION partenaire (clé intégrée, ok, reçu) : Technical Agent → statut "Confirmé partenaire" HITL Agent → validation interne + token unique STOP → attendre HITL, ne pas aller plus loin ↓ → RÉPONSE TOKEN OUI validé : ⚠️ SEULE ET UNIQUE VALIDATION — NE PAS re-déclencher HITL Technical Agent → statut "Activé" + simulation B2Bi Axway Communication → email confirmation partenaire Telegram → ✅ info uniquement ↓ → QUESTION technique partenaire : Communication → réponse email adaptée Technical Agent → log dans Notes échange ↓ → PROBLÈME ou refus : Communication → accusé réception + transmission RSSI Technical Agent → statut "Bloqué" + log Telegram → alerte immédiate

Les règles absolues de l'orchestrateur

Le system prompt de l'orchestrateur contient une section de règles absolues qui ne peuvent jamais être overridées par les inputs utilisateur. C'est la zone de sécurité du système — ce qui empêche l'IA de faire des choses techniquement correctes mais opérationnellement catastrophiques.

R1
Scanner Airtable avant toute action. Aucune action sur un partenaire sans vérification préalable de son statut actuel. Évite les doublons et les actions hors-contexte.
R2
Ne jamais envoyer deux fois le même email le même jour. Le Technical Agent vérifie la date du dernier email envoyé avant tout envoi.
R3
Logger chaque action dans Notes échange. Chaque action est horodatée et appendée au journal partenaire. Traçabilité totale, aucune exception.
R4
HITL obligatoire avant toute activation B2Bi. Sans exception. Même si le partenaire a confirmé par email, même si le token est valide — la validation humaine est non-négociable.
R5
Escalade après 2 relances sans réponse. J+3 première relance, J+7 escalade automatique avec notification RSSI. Statut "Escalade" = intervention humaine requise.
R6
Rapports RSSI uniquement par email. Telegram reçoit des confirmations courtes (max 100 caractères) et des demandes OUI/NON. Aucun rapport détaillé sur Telegram.
R7
Terminer le workflow après envoi d'email. Ne pas attendre la réponse dans le workflow courant — elle arrivera via le Gmail Trigger séparé. Règle critique pour éviter les timeouts et exécutions pendantes.
« L'IA ne remplace pas l'ingénieur MFT. Elle lui redonne du temps pour les décisions qui demandent vraiment son expertise — et elle n'oublie jamais de relancer. »

Ce que j'ai appris en construisant ça

1. Modéliser les états avant de coder les transitions

J'aurais dû concevoir le schéma Airtable complet avant d'écrire la moindre ligne de workflow. Ajouter des champs au fil de l'eau m'a coûté deux jours de refactoring. La règle d'or : écrire tous les états possibles d'un partenaire sur un bout de papier avant de toucher n8n.

2. Ce qui est évident pour un humain doit être écrit pour un LLM

Le comportement de double-validation HITL m'a appris quelque chose d'important : un LLM raisonnant de manière autonome peut parfaitement décider que deux validations valent mieux qu'une. Ce n'est pas une erreur — c'est une inférence valide depuis son point de vue. La précision du system prompt n'est pas du perfectionnisme, c'est de la nécessité.

3. Tester avec de faux partenaires en isolation

Les premiers déclenchements réels ont révélé 3 bugs simultanément. Un environnement de test dédié avec des partenaires factices est indispensable. Tester les filtres Gmail avec des emails envoyés depuis différents clients pour couvrir les edge cases d'encodage.

4. Airtable est la mémoire, pas le LLM

Le memoryBufferWindow en n8n conserve un nombre limité de messages en contexte. Sur des workflows longs, l'orchestrateur peut "oublier" des décisions prises en début de session. La source de vérité doit toujours être Airtable, pas la mémoire de conversation.

5. La latence perçue change tout

Le pattern "Typing Action + Message Patience" — nœuds Telegram qui envoient un indicateur de frappe pendant que l'agent travaille — change fondamentalement l'expérience utilisateur. Sans ça, 8 secondes de silence semblent une éternité. Avec, c'est naturel.

6. Documenter les invariants dans le workflow, pas seulement dans le prompt

Le system prompt peut évoluer. Les nœuds de filtrage représentent des invariants durs qui ne dépendent pas du LLM — ils doivent exister comme gardes-fous dans le workflow lui-même, indépendamment de ce que le prompt dit.

#MFT#n8n#ClaudeAI#SFTP #Axway#Airtable#HITL#Automatisation #Sécurité#MultiAgents#LangChain#GmailTrigger #Telegram#B2Bi
Photo de profil
Ismail Bouchkhi
Consultant Expert MFT · ESIEA Paris

Ingénieur diplômé de l'ESIEA, 15 ans d'expérience sur des plateformes MFT en production — Axway B2Bi, Gateway, Integrator, CFT. Passé par l'AIFE, Groupama, Arval BNP Paribas et SFR Distribution. Actuellement en exploration de l'intersection entre middleware industriel et IA agentique.

MFT & Middleware · AI & Automation · Architecture · Field notes

I automated SFTP key rotation
with n8n, Claude AI and a multi-agent architecture.

65 partners. One rotation per partner, every year. A non-negotiable security policy. And an MFT team doing all of it by hand — 4 hours of technical rotation, plus everything that gravitates around it. I explored whether this could be automated with n8n and Claude AI while keeping humans in the right places. Here's the complete architecture, the system prompts, and what I learned.

Profile photo
Ismail Bouchkhi
Senior MFT Consultant · Middleware & Automation · Paris
Feb 2026  ·  18 min read
"An SFTP key rotation is technically a 4-hour job: key generation, deployment, connectivity testing, supervision. But around those 4 hours live emails to draft, confirmations to wait for, follow-ups to send, statuses to update. Nobody counts that time. When you do, you realize the real cost isn't in the rotation itself — it's in the orchestration around it."
SSH key rotation logs on supervision screens — server room
SSH key rotation in production: logs scrolling, partner statuses updating — what I automated with n8n and Claude AI.

The 650-hour-per-year problem

In most companies running a significant MFT platform — say 50 to 100 active partners — SFTP key governance is handled manually. Not by design: by inherited habit. And because nobody ever measured what it actually costs.

Security policy typically mandates annual rotation. On 65 partners, that's 65 processes to orchestrate every year. The technical part — key generation, deployment in Axway B2Bi, connectivity testing, documentation — is roughly 4 hours per rotation. Visible, plannable. What nobody counts is everything around those 4 hours: back-and-forth emails, follow-ups when partners don't respond, CISO escalations, status updates scattered across days. Another ~6 hours per rotation on average, fragmented across multiple days, invisible in workload reports.

65
MFT Partners
4h
Technical rotation
+6h
Invisible coordination
~650h
Annual total cost

650 hours a year on pure coordination — emails, follow-ups, status updates — that creates zero technical value. More than 4 months of effective work on a repetitive task. And a dangerous single-person dependency: if that person is absent during a critical rotation, the process stops. There's no system memory. Everything lives in people's heads and inboxes.

This project starts from a simple question: can we hand orchestration to an AI while keeping humans where they actually matter? Spoiler — yes. But not without a few surprises along the way.

Multi-agent architecture — overview

I chose n8n as the low-level orchestrator for a specific reason: the ability to build autonomous sub-workflows connected to each other, with a level of control that SaaS platforms don't easily allow. Claude AI runs in each agent as the LLM backbone via @n8n/n8n-nodes-langchain.lmChatAnthropic.

The architecture consists of two main workflows and four specialized agents called as sub-workflows. What makes it robust: no agent acts alone. The orchestrator always decides. Agents execute discrete tasks and return their result — a fundamental distinction from a classic "agent loop" architecture where the agent would make its own decisions.

MFT_KEY_GOVERNANCE — Global architecture
⏰ Scheduler 8AM
Daily trigger
→ Set Trigger Auto
+
📱 Telegram Trigger
Manual command
Text + Voice (Whisper)
+
📧 Gmail Trigger
Partner replies
HITL tokens · Auto-reply
↓ converge to ↓
🤖 MFT Orchestrator (Claude Sonnet)
Central brain — receives context, decides actions, dispatches to agents
Absolute rules · Windowed memory · Strict response format
↓ calls ↓
🔧 Technical Agent
Airtable scan
Statuses · B2Bi sim
Notes logging
📧 Communication Agent
Partner emails
Reply analysis
D+3/D+7 follow-ups
👤 HITL Agent
Dual-channel validation
Email + Telegram
Unique token
📅 Calendar Agent
D+3 reminders
Activation events
D+7 escalation

Workflow 1 — Main Orchestrator

The main workflow has three distinct entry points that all converge toward the same orchestrator:

Entry 01
⏰ Daily Scheduler 8AM
A scheduleTrigger node fires every morning at 8AM. The Set Trigger Auto node automatically builds the input message: "Date: [day] — Daily automatic scan — check all SFTP keys and trigger necessary actions." The orchestrator runs fully autonomously.
Entry 02
📱 Telegram Trigger
The MFT team interacts in natural language via Telegram. The workflow supports text and voice messages — recordings are transcribed in real time via OpenAI Whisper before being passed to the orchestrator. A Classifier LLM (Claude Haiku 4.5) first determines whether the message is "simple" or "complex".
Entry 03
🔄 Restore Input
Programmatic entry for workflow resumptions after waiting — when the system picks back up after HITL validation or receiving a partner reply. Maintains context across two separate executions.

The Classifier — simple or complex?

Before engaging the full Claude Sonnet orchestrator for every Telegram message, a lightweight agent based on Claude Haiku 4.5 categorizes the message as "simple" or "complex". It's one of the finest architectural details of the project.

Classifier Agent — System Prompt
"You receive a message. Reply ONLY with: - "simple" if it's a greeting, short question, thank-you, or message requiring no external action - "complex" if it's a request that requires sending an email, looking up info, managing a calendar, doing a web search, or accessing files or a database Reply with nothing other than "simple" or "complex"."

If simple → direct reply with no tool calls, near-zero latency. If complex → routed to the full orchestrator with all its agents. This Classifier → Router pattern drastically reduces inference costs and latency for routine daily interactions. A Haiku call costs ~20× less than a Sonnet call — over dozens of daily interactions, it adds up.

💡

Key pattern: "Is Acme Corp good to go?" → answer in 1 second instead of 8. This single pattern can justify the two-level architecture on a production system.

n8n workflow — Main Orchestrator with Classifier Agent and Telegram routing
Main workflow: Message Received → Voice or Text → Classifier Agent (Haiku) → Simple/Complex routing → MFT Orchestrator (Sonnet) + its 4 underlying agents.

HITL — dual-channel human validation

The HITL (Human In The Loop) is the system's cornerstone from a security standpoint. No B2Bi activation can happen without prior human validation — hardcoded in the orchestrator's system prompt as an absolute rule, not an option. I chose simultaneous dual-channel validation to maximize the probability of a fast response regardless of where the validator is.

📧
Email Channel
Full structured notification — rotation summary, partner details, unique token in format MFT-YYYYMMDD-HHMMSS, direct validation link. The CISO receives full context for an informed decision.
Regex detection: /MFT-\d{8}-\d{6}/i
on subject and body — some email clients reformat the subject on reply
📱
Telegram Channel
Short alert — max 100 chars, no accented characters to avoid byte offset errors — with inline Approve / Reject buttons. Designed for mobile validation in seconds.
First channel to respond unlocks the webhook resume. The second is ignored. No double-validation possible on the same token.
Full HITL sequence
HITL Agent receives: { partner: "Acme Corp", b2bi_id: "ACC-001", key_hash: "SHA256:..." }Email CISO: subject: "MFT-20260225-143022 — Validation rotation Acme Corp" Telegram: "Validation in progress for Acme Corp ACC-001"Webhook wait: workflow suspended — awaiting resume signal Timeout: 24h → automatic escalationIf APPROVED:Technical Agent: B2Bi simulation + status "Activated" in AirtableCommunication Agent: confirmation email to partnerTelegram info: "✅ Acme Corp activated"If REJECTED:Status: "Blocked CISO" in AirtablePartner email: rotation postponement notification
⚠️

Trap encountered in testing: after email HITL validation (token YES), the orchestrator would re-trigger a Telegram HITL. Perfectly logical from the LLM's perspective — "two validations are better than one." But it's a loop. I had to explicitly forbid it in the system prompt.

Airtable — the single source of truth

The entire governance rests on a single Airtable table SFTP_Partners. It's the system's persistent memory — every agent reads from and writes to this table. No state exists outside it. Statuses follow a strict cycle: New → Email sent → Pending → Partner confirmed → Activated. A status can't regress. Escalation is a terminal state requiring human intervention.

MFT_KEY_GOVERNANCE · SFTP_Partners
# Partner Expiry Status Email sent Confirmation B2Bi activation Follow-ups Exchange notes
1 Acme Corp 15/9/2026 New 0
2 Beta Solutions 20/8/2024 Pending 2/6/2024 1 Awaiting partner confirmation.
3 Gamma Industries 10/7/2027 Activated 25/2/2026 0 2026-02-25 — Confirmation email received
4 Delta Partners 1/10/2024 Active 4/6/20246/6/20247/6/2024 0 Smooth process.
9 Iota Consulting 18/7/2024 Escalated 8/6/2024 3 Third follow-up. [2026-02-24] CISO escalation.

Four fields deserve special attention in implementation:

Status
Single Select — known trap. Airtable returns an object {name: "Activated"}, not a direct string. All comparisons in the workflow must use .name — source of Bug #1 in early testing.
Exchange notes
Long Text — timestamped journal. The orchestrator systematically appends each action via Technical Agent. No action without a trace. This is the system's audit trail.
Follow-up count
Number — escalation trigger. Incremented on each follow-up. When it reaches 3, the orchestrator automatically moves the partner to "Escalation" status and notifies the CISO.
B2Bi activation date
Date — set only after HITL. Its presence in Airtable is proof that human validation occurred before deployment. No shortcuts possible.

Workflow 2 — Gmail Trigger & Email Router

This is the most sophisticated workflow in terms of filtering logic. Every incoming email must be categorized and routed to the right handler — without ever triggering a parasitic action on an internal email, an auto-reply, or an email unrelated to the system. I learned this the hard way during the first real test, where an out-of-office reply was interpreted as a partner confirmation.

n8n workflow — Gmail Router with cascade filter pipeline
Gmail Router: Gmail Trigger → Filter Internal CISO → Filter HITL Token → Filter No-reply & Auto-reply → Airtable Find Partner → Filter Known Partner → Build Orchestrator Context → Email Orchestrator (Sonnet).
Gmail Trigger — listens to all incoming emails
Filter Internal CISO — if From === rssi@lazard.fr → Ignore (internal email)
Filter HITL Token — if subject or body matches /MFT-\d{8}-\d{6}/i → route to token validation
Filter No-reply & Auto-reply — multi-criteria regex:
→ address: noreply|no-reply|donotreply|mailer-daemon|postmaster
→ subject: Auto:|Out of office|Absence du bureau|Automatic reply
→ headers: x-autoreply or auto-submitted present
Airtable Find Partner — lookup by sender email address
Filter Known Partner — if no result → Telegram alert "Unknown sender"
Build Orchestrator Context — snippet, From, Subject
🤖 Email Orchestrator — Claude Sonnet analyzes and acts

Email Orchestrator decision logic

Email Orchestrator — Decision logic
Incoming email analysis: From: {{ emailFrom }} · Subject: {{ emailSubject }} · Content: {{ snippet }}→ PARTNER CONFIRMATION (key integrated, ok, received): Technical Agent → status "Partner confirmed" HITL Agent → internal validation + unique token STOP → wait for HITL, do not proceed further ↓ → VALIDATED TOKEN YES: ⚠️ THIS IS THE ONE AND ONLY REQUIRED VALIDATION ⚠️ DO NOT re-trigger HITL or Telegram confirmation Technical Agent → status "Activated" + Axway B2Bi simulation Communication → confirmation email to partner Telegram → ✅ info only ↓ → TECHNICAL QUESTION from partner: Communication → appropriate email reply Technical Agent → log in Exchange notes ↓ → PROBLEM or refusal: Communication → acknowledgment + CISO handoff Technical Agent → status "Blocked" + log Telegram → immediate alert

Absolute orchestrator rules

The orchestrator's system prompt contains a section of absolute rules that can never be overridden by user inputs. This is the system's safety zone — what prevents the AI from doing things that are technically correct but operationally catastrophic.

R1
Scan Airtable before any action. No action on a partner without first verifying their current status. Prevents duplicates and out-of-context actions.
R2
Never send the same email twice on the same day. Technical Agent checks the last email date before any send.
R3
Log every action in Exchange notes. Every action is timestamped and appended to the partner journal. Full traceability, no exceptions.
R4
HITL mandatory before any B2Bi activation. No exceptions. Even if the partner confirmed by email, even if the token is valid — human validation is non-negotiable.
R5
Escalate after 2 follow-ups without response. D+3 first follow-up, D+7 automatic escalation with CISO notification. "Escalation" status requires human intervention to resolve.
R6
CISO reports via email only. Telegram receives short confirmations (max 100 chars) and YES/NO requests. No detailed reports on Telegram.
R7
Terminate workflow after sending email. Don't wait for the reply in the current workflow — it will arrive via the separate Gmail Trigger. Critical rule to prevent timeouts and pending executions.
"AI doesn't replace the MFT engineer. It gives them back time for decisions that actually require their expertise — and it never forgets to follow up."

What I learned building this

1. Model states before coding transitions

I should have designed the complete Airtable schema before writing a single workflow node. Adding fields incrementally cost me two days of refactoring. The golden rule: write all possible partner states on paper before touching n8n.

2. What's obvious to a human must be written for an LLM

The double-validation behavior taught me something important: an LLM reasoning autonomously can perfectly decide that two validations are better than one. That's not an error — it's a valid inference from its perspective. System prompt precision isn't perfectionism, it's necessity.

3. Test with fake partners in isolation

The first real triggers revealed 3 bugs simultaneously. A dedicated test environment with fake partners is essential. Test Gmail filters with emails sent from different clients to cover encoding edge cases.

4. Airtable is the memory, not the LLM

The memoryBufferWindow in n8n keeps a limited number of messages in context. On long workflows, the orchestrator can "forget" decisions made at the start of a session. The source of truth must always be Airtable, not conversation memory.

5. Perceived latency changes everything

The "Typing Action + Patience Message" pattern — Telegram nodes sending a typing indicator while the agent works — fundamentally changes the user experience. Without it, 8 seconds of silence feels like an eternity. With it, it feels natural.

6. Document invariants in the workflow, not just in the prompt

The system prompt can evolve. Filter nodes represent hard invariants that don't depend on the LLM — they should exist as guardrails in the workflow itself, independent of what the prompt says.

#MFT#n8n#ClaudeAI#SFTP #Axway#Airtable#HITL#Automation #Security#MultiAgents#LangChain#GmailTrigger #Telegram#B2Bi
Profile photo
Ismail Bouchkhi
Senior MFT Consultant · ESIEA Paris

15 years of experience on production MFT platforms — Axway B2Bi, Gateway, Integrator, CFT. Previously at AIFE, Groupama, Arval BNP Paribas and SFR Distribution. Currently exploring the intersection between industrial middleware and agentic AI.

← Précédent← Previous Tous les articlesAll articles MFT 2030MFT 2030