Skip to content

RAG (retrieve)

RAG (retrieve) searches a vector knowledge base for the chunks most similar to a query and returns them. It’s the “read” half of RAG (the other is RAG (ingest), which loads the content).

It has dual use:

  • Connected to the rag port of an AI Agent: the agent retrieves context and injects it into the prompt before answering (so it answers with your content and doesn’t make things up).
  • As a standalone node in a flow: it returns the results in data.results for you to use afterwards.
FieldTypeRequiredDescription
namespacetextYesNamespace to search in (the same you used when indexing).
top_knumberNoHow many chunks to retrieve. Default 4.
providerselectYesEmbeddings provider (openai, local, together, mistral).
modeltextYesEmbeddings model (the same as when indexing).
credentials_idcredentialsYesEmbeddings provider credential.
attach_totextNo*Agent alias (only if used as a RAG sub-node).

Example — Agent that answers about your documentation

Section titled “Example — Agent that answers about your documentation”

This agent answers based on a manual previously indexed in the product-manual namespace.

  1. RAG (retrieve):
    • namespace: product-manual
    • top_k: 4
    • provider: openai, model: text-embedding-3-small
    • credentials_id: your credential
  2. Connect its output to the agent’s rag port (amber).
  3. AI Agent — system_prompt: “Answer using only the retrieved context. If it isn’t there, say so.”

For “how do I configure a webhook?”, the agent retrieves the 4 most similar chunks from the manual and adds them to the prompt before the LLM writes the answer.

{
"query": "how do I configure a webhook",
"results": [
{ "text": "To create a webhook…", "score": 0.89 },
{ "text": "The endpoint receives…", "score": 0.82 }
]
}