Add RAG to an agent
Ask a general-purpose model about your refund policy and it will produce something plausible and wrong. Retrieval-augmented generation fixes that by putting your actual documents in front of the model at question time: the agent searches a corpus you control, and answers from what it finds.
In AXL that means three moving parts - a named document set, an ingest step, and a line in the
agent's rag.toml pointing at the set.
The flow
- Declare a document set in
axl-config/docs.toml. - Put Markdown, MDX, text, HTML, or supported office and PDF files in its
content/directory. - Run
axl rag ingest. - Add the document-set name to the agent's
rag.toml. - Ask the agent a question that the set actually covers.
Steps 1 to 3 are about getting your content indexed; step 4 is about which agent may search it. Keeping them separate is what lets several agents share a corpus, or one agent search two.
Knowledge that is searched
RAG is one of four ways to put information in front of an agent, and it is specifically the one for large bodies of reference material where the relevant part depends on the question.
- A corpus of documents, searched per question - RAG.
- A procedure to follow when a situation arises - a skill.
- Something a person told the agent earlier - memory.
- A short instruction that is always true - a context file.
Provenance comes along for free: every ingested chunk carries a document hash, an ingest timestamp, and signing information, so you can restrict an agent to content from trusted authors.