Aller au contenu
Agentic Workflowdocs
v0.8.2Installer gratuitement

nœuds / builtin / ai / aiagents

RAG Agent

Retrieve and generate an action plan and execute it. Can use external tools.

IA ExtensionApplication web

Ce contenu n’est pas encore disponible dans votre langue.

Answer questions with a chat model that looks up your knowledge base first, and can remember the conversation.

RAG Agent takes the question in Prompt, searches the knowledge base connected to Knowledge for the most relevant passages, adds them to the prompt and asks the chat model on Model to answer from them. It returns the answer and the sources it used.

Retrieved passages are added inside a block marked as reference data, not instructions. A document that says “ignore your instructions” is treated as text to quote, not as a command.

With a chat memory connected to Memory, the agent has a conversation:

  1. Before calling the model, it loads the earlier messages and adds them as chat history.
  2. It saves the incoming prompt as a user message.
  3. After the model answers, it saves the reply as an assistant message (a structured reply from an output parser is saved as JSON text).

This is how a Chat Trigger gets its replies: connect the same memory to the trigger and to this agent.

  • A chatbot that answers from your documents, built with a Chat Trigger.
  • Answer one question from a knowledge base in the middle of a workflow, with the sources it used.
  • Ground a model’s answer in pages you indexed with the Indexer.

To answer fully on-device by quoting your documents, use Q&A Agent with a Local Q&A Model. When the model must also call tools, use Tools Agent, which accepts the same knowledge base.

RéglageTypeCe que cela fait
Prompt (obligatoire)Text
Options GroupThe options for the node.
Options › System message Long textThe system message to use.
Options › Knowledge documents (k) NumberHow many documents to retrieve from the connected knowledge base. Par défaut : 4
Options › Max knowledge context length NumberMaximum characters of retrieved knowledge to inject into the prompt. Par défaut : 4000
Options › Fail on knowledge error ToggleIf enabled, the node fails when knowledge retrieval errors instead of answering without context. Par défaut : Off
Options › Search type ChoiceHow passages are picked from the connected knowledge base. Options: Most similar, Diverse (MMR). Par défaut : Most similar
Options › Match by ChoiceHow a knowledge base is searched with "Most similar". Diverse (MMR) and other vector stores always match by meaning. Options: Keywords and meaning, Meaning only. Par défaut : Keywords and meaning
Options › Minimum relevance NumberDrop passages less similar to the question than this (0 to 1). 0 keeps every passage. Par défaut : 0
Options › Metadata filter Key-value pairsOnly search passages whose metadata matches every key = value (e.g. sourceType = web). Keys use letters, numbers and _; numbers and true/false are matched as such.
Options › Device-only knowledge with a cloud model ChoiceA knowledge base marked "Device only" is never sent to a cloud model. Choose what the node does when its model is a cloud model. Options: Stop with an error, Answer without it. Par défaut : Stop with an error

Prompt is the question. Behind a Chat Trigger, use {{ $input.chatInput }}.

The knowledge base options are the same on the RAG Agent, the Q&A Agent and the Tools Agent:

  • Search type: Most similar picks the passages closest to the question. Diverse (MMR) picks passages close to the question but different from each other, so you get fewer repeats.
  • Match by: with Keywords and meaning, exact words, names and codes are found too. Meaning only uses similarity alone.
  • Minimum relevance: raise it (for example 0.5) to drop weak passages.
  • Metadata filter: useful keys are sourceType (file, web, tab, text, workflow, chat), sourceId, title, url, fileName and page. For example sourceType = web searches only saved web pages.
  • Device-only knowledge with a cloud model: a knowledge base marked Device only (see Privacy) is never sent to a cloud model. Models that count as on-device are Web LLM, Transformers Chat, Ollama, Chrome AI, Local Q&A Model and Local Classifier. With any other model, the node stops with an error, or with Answer without it runs without the knowledge base and logs a warning.
  • Output

Each output item has these fields:

FieldTypeWhat it holds
response AnyThe model reply; the parsed result when an output parser is connected
sources List of entriesThe knowledge base sources used for the answer
Shape of an output item
{
"response": null,
"sources": []
}

sources is present when a knowledge base is connected (it may be empty). Each entry has title, url (when there is one), knowledgeId, sourceId and score. After a run, the node shows a badge such as 3 sources cited.

SlotAcceptsConnections
Model (obligatoire)chat modelOne node.
Memory chat memoryOne node.
Knowledge vector storeOne node.
Output Parser output parserOne node.
  1. Chat Trigger opens a chat window.
  2. RAG Agent with Prompt {{ $input.chatInput }} and System message Answer only from the documents. If the answer is not there, say so.
  3. Connect an Chat OpenAI model to Model, a Local Knowledge node that points at your “Help center” knowledge base to Knowledge, and one Chat Memory to both Memory and the Chat Trigger.

Every message you send runs the workflow; the agent’s replies appear in the chat window.

  • “… is on this device only, but … is a cloud model.” The knowledge base is marked Device only. Use an on-device model, change the knowledge base’s privacy, or set Device-only knowledge with a cloud model to Answer without it.
  • “Knowledge base “…” doesn’t exist on this device.“ The workflow comes from another device or the knowledge base was deleted. Pick a knowledge base in the Local Knowledge node, or import its .awkb file.
  • The answer ignores your documents. No passages were found. Lower Minimum relevance, check the Metadata filter, or try the question in the knowledge base’s Test search tab.
  • The chat window stays empty. The Chat Trigger and the agent use different memories. Connect the same Chat Memory to both.
  • “Model not found”. The connected model node is not set up: open it and choose a model and its credential.
Modifier cette page

Dernière mise à jour :

Was this page useful?
Demander à Aria à propos de RAG Agent