Retrieval-augmented generation (RAG)

Retrieval-augmented generation (RAG) is a technique in which a system first retrieves documents relevant to a request and then gives them to a language model as context for its answer.

How RAG works

The term comes from a 2020 research paper by Lewis and colleagues. A basic pipeline:

  1. Index: split your documents into chunks and store them, often as vector embeddings in a search index.
  2. Retrieve: for each request, find the most relevant chunks by semantic or keyword search.
  3. Augment: add those chunks to the model's prompt.
  4. Generate: the model answers using the supplied text, ideally citing it.

RAG lets a model use private or recent information without retraining, and it makes answers checkable against sources.

Limits

  • Poor retrieval gives the model the wrong context.
  • The model can still ignore or misread sources.
  • Retrieved text is untrusted input and can carry prompt injection.

An example

An agent drafting a launch post searches your docs for the new feature, retrieves its help page, and writes the post from that page. The result names the correct plan limits instead of guessing.

Why it matters for AI-agent publishing

The biggest risk in agent-drafted posts is a confident, wrong claim. Grounding drafts in your own sources reduces that risk, and keeping the source lets a reviewer check.

With SocialHandoff, agents read your voice rules, products, and banned topics with get_brand_memory, a simple form of retrieval. The audit log stores citations such as the GitHub release a draft came from, so reviewers can see what it was built on.

Let your agents post. Keep the final say.

Connect your first agent in minutes. Every draft waits in your inbox until you approve it.

14 days free. No card required.

The hosted version is opening soon

Leave your email and we will send one message when hosted accounts open, with your 14-day trial ready. Want it today? Self-host it free from the repo.

Start free trial