AI that routes and transforms
Send text — watch it get routed and transformed
- 1 Go to Downloads (curriculum.32dots.de/share) and download 'Session 4 — AI that routes and transforms'.
- 2 In n8n: ⋯ → Import from file. Open the chat panel.
- 3 Type: 'Summarize this: The gut microbiome plays a crucial role in immune system regulation through multiple mechanisms including...' (paste any abstract).
- 4 Note the response format: 3-5 sentences.
- 5 Now type: 'Extract key facts from: [same text]'.
- 6 Note the response format: numbered list.
- 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.
Routing with Code node and IF node
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.
- ?What happens if someone types 'extract a summary'? Which branch fires? Why?
- ?Why does each branch have its own Memory node? What would break if they shared one?
- ?How would you add a third branch: 'translate this to German'?
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 In the Router Code node, add a new condition: if lower.includes('translate') or lower.includes('auf deutsch'), set route = 'translate'.
- 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 Add a Build Translate Prompt node: 'Translate the following text to German: ' + userMessage.
- 4 Add an AI Translate agent with its own Groq and Memory nodes.
- 5 Test all three routes with the same input text.
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?