32dots HEIDELBERG AI
Session 4

AI that routes and transforms

easy
USE 0 - 15 min

Send text — watch it get routed and transformed

  1. 1 Go to Downloads (curriculum.32dots.de/share) and download 'Session 4 — AI that routes and transforms'.
  2. 2 In n8n: ⋯ → Import from file. Open the chat panel.
  3. 3 Type: 'Summarize this: The gut microbiome plays a crucial role in immune system regulation through multiple mechanisms including...' (paste any abstract).
  4. 4 Note the response format: 3-5 sentences.
  5. 5 Now type: 'Extract key facts from: [same text]'.
  6. 6 Note the response format: numbered list.
  7. 7 Try with 'bullet points' or 'list' in your message — these also trigger the extract route.

You see two clearly different response formats from the same underlying text, triggered by keywords in your message.

UNDERSTAND 15 - 60 min

Routing with Code node and IF node

💬When chatmessage receivedCHAT TRIGGER🔀RouterCODE NODE — KEYWORD DETECTIONSummarize orExtract?IF NODE📝Build SummarizePrompt / BuildExtract PromptSET NODES🧠AI Summarize /AI ExtractAI AGENTS (TYPEVERSION 1.7)
Key concept

Use deterministic code for routing decisions. If you let an AI decide the route, you lose predictability — models change, prompts drift, and users get inconsistent results. Keyword detection in a Code node never has an off day.

  1. ?What happens if someone types 'extract a summary'? Which branch fires? Why?
  2. ?Why does each branch have its own Memory node? What would break if they shared one?
  3. ?How would you add a third branch: 'translate this to German'?
BUILD 60 - 90 min

Add a third route

Add a 'translate' route: if the message contains 'translate' or 'auf Deutsch', route to a third AI agent that translates the text to German.

  1. 1 In the Router Code node, add a new condition: if lower.includes('translate') or lower.includes('auf deutsch'), set route = 'translate'.
  2. 2 The IF node only handles summarize/extract. Change it: true = summarize, false continues to a second IF node that checks route === 'extract'. False from that = translate.
  3. 3 Add a Build Translate Prompt node: 'Translate the following text to German: ' + userMessage.
  4. 4 Add an AI Translate agent with its own Groq and Memory nodes.
  5. 5 Test all three routes with the same input text.
Deliverable

Export the extended workflow JSON and share with a screenshot showing three different outputs from the same input text on three different routes.

Keyword routing is brittle — 'please give me a summary in bullet form' would route to extract (because of 'bullet'). How would you make this more robust without introducing an AI classifier?