Resources · n8n integration

n8n Question and Answer Chain nodeConfigure Question and Answer Chain in n8n.

The n8n Question and Answer Chain node answers a question using documents you already indexed. It exposes 2 parameters, Source for Prompt (User Message) and Options, and runs on 2 connected sub-nodes, a chat model and a retriever. Built for teams shipping a docs assistant.

Verified Trustpilot reviews · AI, automation & growth agency

Why automate

What does the n8n Question and Answer Chain node actually do?

It takes a question, hands it to a retriever, a sub-node that searches an indexed source and returns the matching passages, then asks a chat model to answer using only those passages. A sub-node is a small node you plug into a port on the side of a bigger one, and it never runs on its own. The chain gives back one answer per incoming item, with no memory of the previous question.

First scenario: an internal support desk. A vector store holds your help center, a Vector Store Retriever reads it, and the chain answers each ticket with the passage that applies. Post the result into Slack and the on-call person gets a draft instead of a search box.

Second scenario: a contract or PDF review. The template 1960 on n8n.io does exactly that, a file lands in Google Drive, gets split and embedded, and the chain answers questions about it afterwards. Here Source for Prompt (User Message) is set to define and Prompt (User Message) carries an expression such as {{ $json.question }}.

Third scenario: a chat window on top of your own documentation. Set the prompt source to auto, wire a Chat Trigger in front, and each message that arrives with a chatInput field becomes a question.

When to pick something else. This chain retrieves and answers, nothing more. If the job needs several steps, a decision, or a call out to another service, the AI Agent node is the right root node, and you give it tools through AI Agent Tool. If nothing has to be retrieved at all, a plain model call from OpenAI or Anthropic is lighter.

Known limits: both ports are required, so the node fails on an empty Retriever with an explicit error. Answers run short by default, and the fix sits in the model sub-node or in splitting the work across several prompts, one question at a time. Nothing is remembered from one item to the next either, so a follow-up question has to carry its own context. The provider behind your model bills its own API calls under its own terms, n8n adds nothing on top.

Connections

What do you plug into the node?

The chain is a root node: the workflow feeds its main input, and the two boxes below hang off ports on its underside, one type of sub-node per port.

Ports (what plugs in)

  • Chat Modelai_languageModelrequired
  • Retrieverai_retrieverrequired
01Chat ModelThis port holds the model that writes the final sentence from the retrieved passages. It also carries the provider credential, which is why the chain itself has nothing to authenticate.

This port holds the model that writes the final sentence from the retrieved passages. It also carries the provider credential, which is why the chain itself has nothing to authenticate.

Key parameters

  • Required: leave it empty and the chain cannot run.
  • OpenAI Chat Model or Anthropic Chat Model: the two most common starting points in the templates.
  • Google Gemini Chat Model or Ollama Chat Model: pick the second one when the workflow must stay on your own machine.
Use cases
swapping this sub-node changes the tone and the length of the answers without touching the rest of the chain.
02RetrieverThis port decides where the context comes from. The retriever receives the question, searches its source, and returns the passages the model is allowed to use.

This port decides where the context comes from. The retriever receives the question, searches its source, and returns the passages the model is allowed to use.

Key parameters

  • Required: with no retriever attached, the run stops on a Retriever sub-node error.
  • Vector Store Retriever: reads a store you filled earlier, the usual choice for indexed documents.
  • Workflow Retriever or MultiQuery Retriever: the first calls another workflow for context, the second rewrites the question into several searches.
Use cases
a knowledge base that changes every day is easier to serve through a Workflow Retriever than through a store you rebuild nightly.
Parameters

Which parameters do you set on the node?

The Question and Answer Chain node has 2 parameters. For each one: the node as you configure it in n8n, what the parameter changes, and our field notes.

01

Source for Prompt (User Message)

promptType

What you see in n8n

Notes & use cases

This selector tells the chain where the question comes from. It is the first thing to get right, because an empty prompt is the most frequent error on this node.

Key parameters

  • Connected Chat Trigger Node (auto): looks for a chatInput field coming from a directly connected Chat Trigger.
  • Define below (define): use an expression to reference data from earlier nodes, or type static text.
  • Prompt (User Message): the question itself, required once you define it below, often {{ $json.question }}.
Use cases
a ticket queue feeds the question through an expression, a live chat window feeds it through the trigger.
02

Options

options

What you see in n8n

Notes & use cases

A collection you grow with Add Option. Nothing here is mandatory, and both entries matter once the chain leaves a test run and starts working through a list.

Key parameters

  • System Prompt Template: the template string used for the system prompt. It has to include the {context} variable for the retrieved context, plus {question} for text completion models.
  • Batch Processing: batch processing options for rate limiting, useful when a single execution sends many questions in a row.
Use cases
rewriting the system prompt template is how you force an answer that cites its source or says it does not know.
Need help

Need help automating Question and Answer Chain with n8n?

A person reads every message.

FAQ

Questions people ask next

01Is the Question and Answer Chain node included in n8n?
Yes. It ships inside the n8n AI package, so it is there on n8n Cloud and on a self-hosted instance under the Community Edition and its Sustainable Use license. There is nothing to install and nothing extra to pay on the n8n side, and a workflow behaves the same whether you run it from Docker on your own server or from the hosted offer. The one bill that does exist comes from the model provider behind the chat model sub-node, which charges its own API calls under its own terms.
02What do you need to make the n8n Question and Answer Chain node work?
Nothing on the node itself. It has no credential and no Authentication selector, so there is no account to connect and no key to paste into it. What it needs instead is two sub-nodes on its ports. The chat model sub-node carries the provider credential, so the key lives there, on the OpenAI Chat Model or the Anthropic Chat Model for instance. The retriever sub-node carries whatever its own source requires, typically the vector store it reads from. Get those two attached and the chain runs.
03What are the limits of this node?
It answers questions about retrieved documents, and that is the whole job. It holds no memory between questions, it takes no decisions, and it calls no external service on its own. Both ports are required, so an empty Retriever stops the run with an explicit error. Answers also come out fairly short by default. The documented fixes are a model with a larger context window, a higher Maximum Number of Tokens on the model sub-node, or building a long reply in stages across several prompts. Version 2 is the one described here.
04What has to be connected at minimum, and where do you start?
Two sub-nodes, no less: a chat model on the Chat Model port and a retriever on the Retriever port. For a first build, the pair that appears in most templates is an OpenAI Chat Model with a Vector Store Retriever reading a store you filled beforehand. Add the documents in a separate workflow, with a loader, a text splitter and an embeddings node, then point the retriever at that store. Once the answers look right, swapping the model sub-node for another provider is a one minute change.
05n8n or Make for a retrieval question answering flow?
It depends on where the data has to live and how you like to pay. n8n runs on your own server or on its hosted offer, with the same workflow either way, which matters when the indexed documents are internal. Make is hosted only, with no self-hosting option, and bills per operation, which is easy to forecast when volume is steady. On the AI side the difference is the sub-node model: in n8n the chain, its model and its retriever are separate blocks you swap one by one. Try both on a real question before deciding.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.