RAG and data agents: which AI do you need?

What RAG and data agents are, how to tell which one your business needs, how to prepare your data and documents, and when to fix the data first.

Last updated

What is RAG, and what is a data agent?

A project manager at a Dubai fit-out contractor calls head office twice before lunch. First she wants to know which of her jobs are over budget on labour this quarter. Then she asks how much notice the contract on the hotel job gives before the company can claim for a variation to the agreed work. Both sound like work for the same kind of AI, one that knows the business. The two answers live in different places, though, and they need two different systems.

The first answer is a number worked out from records, the timesheets and budgets in the company’s project-cost system. A data agent answers that kind of question. It turns the question into a query, the exact request a database understands, runs it and reports what comes back, so the figure comes from the records themselves. Developers call the technique text-to-SQL, after SQL, the standard language for querying databases that keep their data in tables.

The second answer is a sentence someone wrote, in a contract. A document reader answers that kind. It searches your documents for the passages that look most relevant, hands them to a language model and has the model write an answer from them, ideally pointing to where each part came from. That’s RAG, short for retrieval-augmented generation: retrieve the passages, then generate the answer.

Even the explainers blur the two. IBM’s page on RAG says it lets people “query databases with conversational language”, which describes the first system more than the second, while Microsoft’s own data agent, in its Fabric data platform, doesn’t read PDF or Word files at all.

The difference decides what you can trust. A data agent’s figure depends on the query it wrote and on the records it ran over, and the query can be read and checked. A document reader’s answer is the model’s account of whatever the search found, so it depends on the passages it was handed and on what the model made of them.

If a vendor offers to “train the AI on your documents”, ask what they mean. OpenAI’s guide to improving accuracy separates the problems: a model that needs your proprietary information should be given it as context when it answers, which is what retrieval does, while further training, called fine-tuning, is for inconsistent format, tone or reasoning. So if what you want is answers from your own documents, what you’re buying is retrieval.

Either system makes your records or your documents quicker to reach, the wrong parts included, and that’s what to plan around.

RAG or a data agent: which do you need?

The answer is already in the questions your people ask, so start there rather than with anyone’s demo. At the fit-out contractor they reach head office as calls, emails and messages from site:

  1. Collect the questions as they were asked, over two or three normal weeks, from whoever answers them now: the commercial team, the document controller, the person everyone rings.
  2. Sort each one by where its answer lives. A figure worked out from records goes in one pile, a sentence someone wrote down in another. An answer that lives in nobody’s records, because it needs judgment or was never written down, goes in a third.
  3. Count the piles, and note who answered each question and how long it took them.

A big pile of figures points to a data agent only if the questions in it vary. One that arrives every Monday, labour cost against budget by project, is a report, and a scheduled report answers it exactly, every week, with nothing to check. That’s integration and automation rather than AI. A data agent earns its keep on the questions nobody predicted, asked by people who can’t query the database themselves, when the one person who can has become a queue.

Where the written answers pile up, look at who ends up answering them. If the answer exists but nobody can find it, the same questions keep reaching the same few senior people who remember which contract says what, and that’s the gap a document reader fills. If customers would be the ones asking rather than staff, you’re looking at a customer-facing chatbot, which is a different decision with its own costs.

Whatever lands in the third pile stays with people, because no system can answer from records that don’t hold the answer.

Some questions straddle two piles. “Is the overrun on this job covered by a variation the contract allows?” needs the cost figures and the clause. Start with whichever pile is bigger and add the other later, because each half has its own preparation and its own ways of going wrong.

Preparing your data for a data agent

A database doesn’t know what your words mean. Ask a data agent which projects are over budget and it has to decide what “over budget” means before it can write a query: against the budget agreed at contract, or the one revised after the client approved variations? Whichever it picks, the query runs and a list comes back, and unless the agent shows its query or its assumptions, nothing tells the person asking which meaning it used. In the projects we see, preparing data takes 40 to 70 percent of the effort of building an AI system, and for a data agent that preparation includes deciding what the business means by its own words and writing it down.

Do it before any build starts, with the people who answer the questions now:

  1. Take the twenty questions that matter most from those whose answers are figures in your records, and list the tables and fields each one needs.
  2. Write one definition for every number in them. “Last quarter” needs to say calendar or financial year, and “labour cost” needs to say whether subcontractors count. Where two departments use a word differently, settle it now, because otherwise the agent picks one for you.
  3. Record how values are actually stored. If the location field says “Abu Dhabi” on some projects, “AD” on others and “AUH” on the rest, a question about Abu Dhabi filters on one spelling and reports a confident total that leaves out the jobs stored under the other spellings, or reports none at all.
  4. Where several tables look alike, mark the one to use, such as the cost table finance closes each month rather than the working copy site teams update.
  5. Keep the definitions, stored values and table choices in one place the agent reads every time, and give each of them an owner.

Buying the agent doesn’t skip this. Snowflake’s version needs your business terms, metrics and table relationships set up in the database before it can answer, because, in Snowflake’s own words, database schemas “lack critical knowledge like business process definitions and metrics handling”. Microsoft’s takes written instructions, with “custom rules or definitions that clarify organizational terminology”, plus example questions paired with the query that answers them. Either way, the meanings have to come from your own people, whoever types them up.

Preparing documents for RAG

Picture the shared drive at a fit-out contractor. There’s a folder per project, with the signed contract and two drafts side by side. The site safety procedure has been revised twice and saved three times, specifications have been scanned from paper, and some letters from a government client exist only in Arabic. A person who knows the drive works round all of it without thinking. A document reader can’t, because it fetches whichever passages read closest to the question, and nothing in a passage says it belongs to a superseded draft.

So the preparation is making the document set agree with itself:

  1. Gather the documents the system should answer from into one place, and leave everything else out. A draft contract, an old procedure and a stray duplicate are each something the system can quote back with confidence.
  2. Give each document a status, a date and an owner, so that when a document is revised the system can tell which version is current, and somebody is responsible for retiring the old one.
  3. Check that scanned pages turned into readable text, and check the Arabic ones first. Arabic is written right to left in a joined-up script, and software reading a scan has to cope with both. In a 2025 benchmark, the best model tested scored 65 percent at turning a small set of deliberately difficult Arabic PDFs, full of tables, watermarks and handwritten notes, into formatted text, scored on the words and the table layout together. Read a sample of the converted text against the original pages before trusting anything built on it.
  4. Where a contract exists in Arabic and English, decide which version the system answers from. Then test questions in each language against documents written only in the other, because a 2025 study of Arabic and English document readers found search did markedly worse when the question and the document were in different languages. If English questions miss Arabic clauses, ask the builder to search in both languages, for instance by translating each question before searching.
  5. Fix permissions before anyone asks a question. A reader that honours your existing permissions, as Microsoft says its Copilot assistant does, lets each person ask about anything they can already open, so a folder shared with the whole company years ago becomes something anyone can ask about. A reader that doesn’t check permissions can show anyone whatever documents were loaded into it, so ask which kind you’re buying before anything confidential goes in.

How the documents get cut up matters too. To search them, these systems split documents into short passages, and a passage cut loose loses its context. Anthropic’s example is a passage saying a company’s revenue grew 3 percent over the previous quarter, which no longer says which company or which quarter. Ask any builder how their system keeps track of where each passage came from.

A small enough set may not need searching at all. Anthropic’s guidance is that a knowledge base under about 500 pages can be given to the model whole. A safety manual and a dozen procedures may fit, and they still need the right versions, but nothing can get lost in a search.

How data agents and RAG get answers wrong

Both systems can give a wrong answer that looks just like a right one, so the thing to plan for is how someone will notice.

A data agent’s wrong answers come from its query, and a wrong query runs without complaint. It used the revised budget when a project manager meant the original, read “this quarter” as the financial quarter, or filtered on a spelling the database doesn’t use and found nothing over budget in Abu Dhabi. Each of those produces a tidy table. The check is an agent that shows its working with every answer: the table it used, the filters, the date range, and the query itself, translated into words she can read. Then a financial quarter where she meant a calendar one is something she can catch before the figure reaches a meeting.

A document reader’s wrong answers come from what it retrieved. It quotes the draft contract instead of the signed one, or finds two procedures that disagree and answers from one without mentioning the other. Or it cites a document that doesn’t say what the answer claims, and that one is the easiest to trust, because a citation is what makes an answer look checked. When Stanford researchers tested legal research tools in 2024, from makers who promoted retrieval as the guard against made-up answers, each tool’s answers contained a hallucination between 17 and 33 percent of the time: a false statement, or a source cited for something it doesn’t support. The check is an answer that quotes the passage it relied on, a link that opens the document at that passage, and a system built to say it found nothing rather than fill the gap.

Both drift after launch without anyone being told. Someone renames a field in the database the agent queries, and the agent’s queries fail or start reading the wrong column. A revised procedure is saved as a new file, and the old one stays searchable beside it. The defence is the same for both: a fixed set of real questions with known answers, run again every month and before any change to the system, the model or the data underneath, and one named person who reads what fails and fixes the definition or retires the document.

Build, buy or fix the data first

Which way to go depends on how far the preparation is from done.

Fix the data first if the definitions behind your figures are still disputed or the documents have no owner. A data agent pointed at two meanings of “over budget” will answer with whichever it picks, and a document reader over an unsorted drive will quote the drafts. The fixes are worth doing anyway: agreed definitions stop reports disagreeing about what a word means, and a sorted drive helps everyone who searches it. Checking whether your data is ready comes before choosing between building and buying.

Try buying first if your data already sits in a platform that includes an agent, or your documents in an office suite that includes an assistant. Run a set of real questions whose answers you already know through it, and compare. That costs little, it shows whether the preparation worked, and the definitions and the sorted documents carry over to anything you build later. Before signing up, check which languages it takes questions in and where it sends your data. Microsoft’s Fabric data agent, according to its current documentation, takes questions only in English, and where the data is held outside the EU and the US, an administrator has to allow it to be processed and stored in another region before the agent works. And any document reader sends passages of your documents to a model every time someone asks a question, so the documents go wherever that model runs, which is a question for whoever advises you on data protection.

Build when the off-the-shelf version fails your questions for a reason it can’t fix: the questions span systems no product connects, the people asking write in Arabic, most of the documents are in Arabic, or the data has to be processed inside the country. A build has running and upkeep costs of its own, so budget for its upkeep as well as the build, and hold every proposal to the same set of questions with known answers.

Whichever you choose, the system needs an owner on your side, the person who keeps the definitions current and retires the old documents. We’d name that person before choosing a vendor, because a year from now they’re the one who’ll know whether the answers can still be trusted.

Standing offer

The hard part is deciding what to do first

Bring us a URL, an audit report, or a proposal you're not sure about. We'll tell you which problems deserve budget this quarter, and you'll leave with an order of operations you can hand to whoever does the work, whether that's us or not.

Book twenty minutes