Skip to content
Agentic Workflowdocs
v0.8.2Install free

concepts / ai

RAG

Answer from your own documents: how retrieval-augmented generation works in AWFlow, and how to fix answers that ignore your sources.

A RAG Agent answers a question from a help-centre knowledge base. Next to the answer, sources lists the passages it used, so you can show or check them.

Example run: Chat Trigger, 1 item → RAG Agent, 1 item. Illustration of a run. Each source also carries knowledgeId and sourceId.

Output of RAG Agent
{
  "response": "Yes. Gifts can be returned within 30 days for store credit [S1].",
  "sources": [
    {
      "title": "Returns and refunds",
      "url": "https://help.example/returns",
      "score": 0.82
    },
    {
      "title": "Gift cards",
      "url": "https://help.example/gift-cards",
      "score": 0.61
    }
  ]
}
Illustration of a run. Each source also carries knowledgeId and sourceId.
flowchart LR
  Docs[Files, pages, text] --> Split[Split into passages] --> Store[(Knowledge base)]
  Q[Question] --> Search[Search by meaning] --> Model[Model answers from the passages] --> A[Answer and sources]
  Store --> Search
  class Store awf-data
  class Search awf-flow
  class Model awf-ai
  class A awf-ok

Filling the knowledge base happens once, then again when the sources change. Answering happens on every question.

For an indexing workflow:

  1. Load the content with a loader, such as URL Document Loader, File Document Loader or Current Page Document Loader, or read the page with Get All Text.
  2. Send it to the Indexer, with a text splitter and a Local Knowledge node connected. Set Source link so a later run updates the same source instead of adding a copy.
  3. Run it on a Schedule if the source changes.

The knowledge base embeds the passages with its own model. See Embeddings and vectors.

Connect the same Local Knowledge node to a RAG Agent, a Q&A Agent or a Tools Agent. Before you build the answering step, use Test search on the knowledge base page to check that a typical question finds the right passages.

The answer is generic, as if the documents weren’t there

Nothing relevant was found. Run Test search with the same question. If the right passage doesn’t come up, add the missing source, or reword the question the way your documents phrase it.

The answer mixes up two topics

Loosely related passages reached the model. Raise Minimum relevance (for example to 0.5), use a Metadata filter to search only the right sources, or split unrelated documents into separate knowledge bases.

The answer adds details that aren’t in your documents

The prompt lets the model fill gaps. Say “answer only from the sources” and give it a fallback for missing answers.

The answer is out of date

The knowledge base still holds the old version. Re-add the source, or set Source link in your indexing workflow so each run replaces it.

sources is empty

No passage passed the search, often because Minimum relevance is set too high, or the Local Knowledge node isn’t connected to the agent’s knowledge slot. Lower the setting and check the connection.

Ask Aria