Skip to main content

Retrieval (RAG)

A Retrieval node queries a vector database and returns the closest chunks. A downstream Agent node can then answer from your documents, not only from what the model learned in training.

Drag a Retrieval node from the Retrieval group of the canvas palette, then configure it in the right-hand panel.

Supported backends​

BackendCan embed the query itself?
pgvector (Postgres)No, use BYOK
PineconeNo, use BYOK
QdrantNo, use BYOK
WeaviateYes

You bring an index that already exists. The node queries it, but it doesn't build it.

Embedding mode​

The search needs a vector for the query. There are two ways to get one:

ModeWhat happens
Backend-embeddedThe query text is sent as is, and the vector store embeds it. This only works with Weaviate.
BYOK (bring your own key)The query is embedded with your own OpenAI or Google key, using the Embedding model you name (default text-embedding-3-small), and the vector is sent. Works with every backend.

If you pick a backend that can't embed text while the node is in Backend-embedded mode, the panel warns you, and the node fails at run time until you switch to BYOK.

:::warning Model must match your index The embedding model for the query must be the same one that indexed your documents. A text-embedding-3-small query vector searched against an index built with text-embedding-004 returns nonsense, not an error: the numbers live in different spaces. :::

Configuration​

FieldNotes
BackendWhich vector store to query. Changing it clears the saved connection.
Embedding modeSee above
Embedding modelBYOK only
Top KHow many chunks to return. Defaults to 5. Values are kept between 1 and 50, and zero, negative or non-numeric values fall back to 5.
ConnectionThe backend's fields (below). Click Save connection to store them.

Connection fields per backend:

BackendFields
pgvectorConnection string, Table, Embedding column, Text column
PineconeIndex host, API key, Namespace, Text metadata key
QdrantURL, API key, Collection, Text payload key
WeaviateURL, API key, Class name, Text field

After saving, the panel shows the saved host and collection. It never shows the credentials.

What the node outputs​

The node reads the query from its input: plain text, or the query field of an object. It outputs { "chunks": [...], "query": "..." }.

Each query costs 1 credit, like a built-in tool call.

Security​

Retrieval connections touch your infrastructure, so they get the same protections as data pipelines:

  • Connection fields are encrypted with AES-256-GCM when you save them, and they're decrypted only when the node runs.
  • Hosts on private networks are refused: localhost, private IP ranges and the cloud metadata address.
  • Requests time out after 30 seconds.
  • Endpoints and keys never appear in error messages.

Grounding an agent on the results​

Connect the Retrieval node's output into an Agent node. In the agent's prompt or rules, tell the model to answer from the chunks it receives.

A typical shape:

Input → Retrieval → Agent → Output
note

Retrieved content is untrusted text. If other people can edit your documents, a document can carry instructions aimed at your agent. That's the indirect prompt injection path. Run a security scan: static.injection.indirect_tool_feedback checks for exactly this.