⚗️ 32dots Learn ist ein experimenteller Prototyp — Inhalte und Funktionen ändern sich kurzfristig.
Karte 07 · Kapitel tools

Building a research assistant

n8n medium 90 min
🟢 USE — Run first
0 - 15 min

Ask a research question — get a synthesised answer across papers

This workflow implements a research assistant: it searches PubMed for papers relevant to your question, retrieves structured metadata, and synthesises an answer that maps the research landscape.

  1. Go to Downloads (curriculum.32dots.de/share) and download 'Session 7 — Research assistant'.
  2. In n8n: ⋯ → Import from file. Open the chat panel.
  3. Ask: 'What are the current approaches to CAR-T cell therapy in solid tumors?'
  4. Watch the execution log: Plan Search → PubMed Search → Extract IDs → Paper Details → Format → AI Synthesizer.
  5. Ask a follow-up: 'Which of those approaches is furthest along in clinical trials?'
  6. Ask: 'What are the common limitations mentioned across these papers?'
  7. Open the Format Paper List node — inspect the paper list it builds from the esummary JSON.
Done-Signal: You receive a synthesised answer that references specific papers by PMID, plus a coherent follow-up answer that uses the same papers.
🔵 UNDERSTAND — Look inside
15 - 60 min

Pipeline-as-tool-use: the n8n model of ReAct

In an autonomous agent (like Dify), the model decides WHEN to call tools and WHAT to pass. In n8n, you design the tool call sequence as nodes. Compare these two approaches — same result, different philosophy.

🔧 Plan Search
Code node — build search URL
Takes the user's question as-is and URL-encodes it for PubMed. In a more complex system, an AI would transform the question into a better search query first — that's the 'Reason' step in ReAct.
🔎 Tool — PubMed Search
HTTP Request = 'search tool'
This node IS the search tool. In an autonomous agent, the model calls this tool by name. In n8n, it runs deterministically every time. Result: always predictable, never surprises you.
⚙️ Extract IDs
Code node — parse IDs, build esummary URL
Parses the esearch JSON idlist. Builds the URL for the second tool call. In an agent, this transformation would happen inside the model's reasoning step.
📚 Tool — Paper Details
HTTP Request = 'details tool'
Fetches structured metadata: title, authors, publication date, journal. esummary returns JSON — cleaner than efetch text for metadata. This is the second 'Action' in the ReAct loop.
📝 Format Paper List
Code node — format for AI context
Formats each paper as: PMID, title, first author, year, journal. This is what gets passed to the AI as 'tool results' — equivalent to the 'Observation' step in ReAct.
🧠 AI Research Synthesizer
AI Agent (typeVersion 1.7)
Receives the formatted paper list and the user's original question. Synthesises an answer across multiple papers, identifies patterns, cites PMIDs. This is the final 'Respond' step.
The ReAct pattern (Reason → Act → Observe → Respond) is universal. In Dify, the model controls the loop autonomously. In n8n, you design the loop as a workflow. n8n gives you full visibility and control; Dify gives you flexibility for open-ended tasks. Neither is better — they solve different problems.

Probe-Fragen

  • What stops the n8n version from running multiple search rounds (like an autonomous agent would)?
  • In the Format Paper List node, what happens if esummary returns no results for a PMID? Is there error handling?
  • For what types of research questions would a Dify agent give better results than this n8n pipeline?
🟠 BUILD — Make it yours
60 - 90 min

Add a second search round for related papers

Extend the pipeline with a second PubMed search triggered by the AI's first response.

Aufgabe: After the AI Synthesizer responds, extract the most important keyword from the response and run a second, focused PubMed search. Return the combined results.

  1. After AI Research Synthesizer, add an AI Agent node: 'Extract the single most important keyword or phrase from this response for a follow-up PubMed search. Return ONLY the keyword, nothing else.'
  2. Add a Code node: build a new esearch URL using the extracted keyword.
  3. Add HTTP Request → Extract IDs → HTTP Request (efetch or esummary).
  4. Add a Set node: combine original papers + second-round papers.
  5. Add a final AI Agent: 'Using these papers, write a one-paragraph research landscape summary.'
  6. Test: does the second search find papers the first search missed?
Deliverable: Screenshot of a run showing two search rounds and a final synthesis paragraph that references papers from both rounds.
✓ SELF-CHECK

Hast du das verstanden?

  • I can explain the n8n equivalent of each ReAct step (Reason, Act, Observe, Respond).
  • I understand why the session key uses $('When chat message received').first().json.sessionId.
  • I extended the pipeline with a second tool-call round.
Your pipeline always does exactly two tool calls in a fixed order. An autonomous agent would decide dynamically whether to search again, refine the query, or stop. What types of questions would the autonomous approach handle better? When is the fixed pipeline preferable?
💬 KI-TUTOR

Frag den Tutor zu dieser Karte

Sokratisch: der Tutor antwortet mit Leitfragen statt fertigen Antworten — du erarbeitest die Lösung selbst.

Stell eine erste Frage zu dieser Karte unten.