New Tool Radar

AI Agents & Automation

How to Give an n8n AI Agent a Vector Store Retrieval Tool

Add a vector store retrieval tool to an n8n AI agent so it can answer from your own documents.

Schematic with three steps: Add the vector store question-answer tool; Describe the tool as the first source; Ask the test questions and check the.

An n8n AI agent can answer from your own documents when a vector store is wired as a tool: the agent searches the store for passages matching the question and grounds its answer in what it finds. The store must be loaded first, with your documents embedded and indexed, and the tool description must tell the agent to search before answering from general knowledge.

What you need

  • An n8n workflow with a working AI Agent node and chat model
  • A vector store with your documents already loaded and embedded
  • Three test questions whose answers are only in your documents

Step 1: Add the vector store question-answer tool

On the AI Agent node, open the Tool connector and add the vector store question-answer tool, pointing it at the store that holds your documents.

Step 2: Describe the tool as the first source

Name the tool search_docs and describe it as the place to look before answering: the agent must search the documents first and say when the documents do not cover the question.

Step 3: Ask the test questions and check the answers

Ask the three test questions and confirm each answer comes from the documents, not from general knowledge. If the agent answers without searching, or cites a passage that does not exist, tighten the description and re-test.

Worked example: synthetic document questions

The table below is a synthetic example. It shows the expected result of retrieval; no search was run.

Question Tool called? Answer from docs?
Refund window for annual plans Yes Yes
Onboarding steps for new staff Yes Yes
Question outside the documents Yes No – agent says so

Expected result (UNTESTED). the agent searches the store for all three questions, answers two from the documents, and says the third is not covered instead of inventing an answer. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • The tool can only find what was loaded into the store, so an empty or stale store gives empty or wrong answers.
  • Embeddings and the store must match; a store loaded with one embedding model does not work with another.
  • The agent must be told to say when the documents do not cover a question, or it will answer from general knowledge.

Sources

See all