LLM integration and RAG development: cited answers from your data

A RAG prototype that answers ten questions well is easy. A system staff trust across 50,000 documents is an engineering job: permissions, freshness, citations and measured quality, at a cost you can check against published market figures.

In short

LLM integration and RAG development is connecting a language model to your own data so it answers with sources, and adding model features such as summary, extraction or classification to software you already run. Retrieval-augmented generation finds the passages a user is allowed to see, then has the model answer only from them, and says so when the documents do not contain the answer.

RAG-powered agent build (market)
$30,000 to $80,000 (Keyhole Software) Source: Keyhole Software
RAG-powered agent run cost (market)
$500 to $2,500 a month (Keyhole Software) Source: Keyhole Software
RAG-powered agent timeline (market)
6 to 12 weeks (Keyhole Software) Source: Keyhole Software
AI proof of concept, UK (Magora's published price)
From £10,000 in 4 to 6 weeks (Magora) Source: Magora

When RAG or an LLM feature is the right build

This service is one part of our AI and generative AI development work, and it covers two related builds. RAG grounds a model in your documents so it can answer questions about them, with sources. LLM integration adds a single model step, such as a summary, a classification or extracted fields, to software you already run.

Two neighbors get confused with these. An agent uses tools to act: if the system must also update records, send messages or trigger workflows, you need AI agent development, not a pure retrieval build. A chatbot is a conversation layer, and it can sit on top of either.

What you need What fits What does not fit
Answers from hundreds or thousands of documents that change every month RAG with an index that syncs on change Uploading files to a chat tool by hand
A summary or extracted fields on one screen of your product LLM integration, no retrieval index A full RAG pipeline
Answers that live as numbers in a database Text-to-SQL or BI reporting Document RAG, which retrieves passages and cannot reliably total, filter or compare rows
A model that writes in a fixed style or format Prompting and schema-constrained output first, fine-tuning if those fail RAG, which adds knowledge, not behavior
A few dozen documents that rarely change Long-context prompting, possibly no index A vector database you then have to run
Staff search across standard workplace tools with no custom logic A packaged enterprise assistant from your workplace suite, evaluated first A custom RAG build

Long-context models do not remove the need for retrieval on large or permissioned collections: you cannot send 50,000 documents with every question, and you must not send a user text they are not allowed to read. For a small, static set, they may make an index unnecessary, and scoping should say so plainly. A custom build earns its cost when the answers live inside your product, the sources are unusual, or the permission, residency or measured-quality requirements go beyond what a packaged tool shows you.

What a production RAG system contains

A demo needs a prompt and a folder of PDFs. A system people rely on needs the parts below. The fifth covers LLM features that need no index, and evaluation, which runs through all of them, has its own section further down.

Ingestion

Connectors pull from the places your knowledge lives: file stores, wikis, ticketing tools, CRMs and databases. Parsing has to handle what is actually in them, including tables, headers, multi-column layouts and scanned PDFs that need OCR. Chunking is tuned to the document type, because a contract clause, a support ticket and a product manual split differently. Each chunk carries metadata: source, owner, date and access groups. Duplicates and superseded versions are detected at ingestion and marked, so an old policy in a shared folder does not outrank the current one.

Retrieval

Text is converted to embeddings and stored in an index. That can be a dedicated vector store or vectors inside a database you already run, such as PostgreSQL with the pgvector extension. Production retrieval is usually hybrid: keyword search catches exact terms like part numbers and clause references, vector search catches meaning, and a re-ranker orders the combined results. Metadata filters narrow the search by date, product, region or permission.

Some questions need more than one search. A follow-up in a conversation is rewritten into a standalone query before search. A comparison across several documents can use agentic retrieval, where the model plans and runs several searches before answering; its only tool is read-only search under the user's permissions, and it is kept only if the evaluation set shows a gain worth the extra latency and tokens. Knowledge-graph approaches such as GraphRAG help when answers depend on relationships across many documents, and add an extraction step that must stay in sync.

Generation with citations

The model receives the question and the top passages, and it is instructed to answer only from them. Every claim links to the passage it came from. When the passages do not support an answer, the system says so instead of guessing.

Permissions and freshness

Access rights are mirrored from each source system and applied inside the index query, before the model sees anything. That needs one identity per user across sources, usually from your single sign-on, with group memberships expanded. Permission changes sync faster than content, so a person removed from a group stops seeing its documents within an agreed window. Filtering after the answer is written is too late, because restricted text has already shaped it. Sync is incremental: changed documents are re-processed and deleted ones are removed, so a withdrawn policy stops appearing in answers.

LLM features without retrieval

Many requests need no index at all: summarize a case file, classify inbound email, extract fields from an invoice into JSON. The engineering is in the edges: schema validation, timeouts, retries, a fallback model and per-request cost limits. Answers are streamed so users see text as it is generated, and simple requests go to a smaller model.

Operations and handover

Every query is traced: the question, the passages retrieved, the answer and the user's feedback. Traces contain the same restricted text as the index, so access to them is limited by role and they are deleted on a retention period agreed in scope. A good handover includes the pipeline code, prompts in version control, the evaluation set with its latest scores, infrastructure definitions and a runbook for re-indexing and model changes; ask for the list in writing. Model versions are pinned, and the runbook covers moving to a replacement and re-running the evaluation set first.

What an LLM integration or RAG build costs

Every engagement starts from a written scope that both sides agree before build work begins, and the quote follows from that scope. To check any quote you receive, the table below shows what published 2026 market sources report.

Build shape Scope as labeled by the source Timeline Build cost (published) Monthly run (published)
AI proof of concept, UK AI proof of concept, scoped after a discovery phase 4 to 6 weeks From £10,000 Not stated
RAG-powered agent Adds a retrieval pipeline and evaluation to a simple agent 6 to 12 weeks $30,000 to $80,000 $500 to $2,500
RAG knowledge agent Retrieval over internal documents with cited answers Not stated $30,000 to $180,000+ Not stated

Keyhole Software prices agents that use retrieval. On this page, a system that only retrieves and answers is a RAG build, and one that also takes actions is an agent. The proof-of-concept row is Magora's published UK starting price, scoped after discovery (Magora, 2026). The other rows come from Keyhole Software's October 2026 review of more than 45 published sources, which puts first-year cost of ownership for a RAG-powered agent at $46,000 to $126,000 (Keyhole Software, 2026). These are published estimates, not audited project actuals and not our prices. For how fixed-scope, time and materials and dedicated team contracts are billed, see our pricing models.

What drives the monthly run cost

  • One-off embedding of the whole collection, then re-embedding of every changed document.
  • Vector storage, which grows with the number of chunks and the size of each embedding, plus the stored text and metadata.
  • Model tokens per answer: the instructions, the question and any conversation history, plus every retrieved passage, plus the answer, times answers per month, plus re-ranker calls if a hosted re-ranker is used. Sending 20 passages instead of 5 can multiply this line.
  • Hosting, logging and monitoring.

Two levers cut the bill without hurting quality when they are tested properly: routing simple questions to a smaller model, and caching the parts of the prompt that repeat, such as fixed instructions, or the whole document set in a long-context build. For a deeper breakdown, read what an AI agent with retrieval costs to build and run.

How to judge a RAG quote

A credible quote names the sources and document counts it assumed, names the models and token prices behind the run-cost figure, states a latency target, says whether OCR and table parsing are included, states how permissions are mirrored, includes the evaluation set as a deliverable, and gives a monthly run-cost estimate at your expected volume.

Who builds a RAG system

A RAG build is mostly data and backend work. An AI engineer owns retrieval design, prompts and scoring. A data engineer owns connectors, parsing and sync. A backend engineer owns the API and permission filters. A QA engineer owns the evaluation set and regression runs.

Ask any vendor who fills each role, how their working hours fit yours, and who on their side talks to your subject experts while the evaluation set is written.

How a RAG project runs

  1. Source audit. Which systems, how many documents, which formats, who may see what, how often they change. Output: a source inventory and an access map.
  2. Evaluation set. 100 or more real questions with the correct source passages and reference answers, written with your subject experts. It includes questions the documents cannot answer, questions asked by users with different access rights, and, for mixed collections, questions in each language. Output: the test that every later step is judged against.
  3. Baseline retrieval. Index a representative sample with its access metadata from the first load, then measure retrieval before any prompt work. Output: a first recall score.
  4. Retrieval tuning. Adjust parsing, chunking, hybrid search and re-ranking against the set. Output: scores per configuration.
  5. Generation. Add citations and refusal behavior, then measure faithfulness. Output: answer scores and failure categories.
  6. Permissions and sync hardening. Turn on incremental sync and permission-change propagation, then test that a user cannot retrieve a restricted document, including one whose access was just removed. Output: passing permission tests.
  7. Pilot. Real users with feedback buttons on every answer. Output: error categories, fixes and a measured cost per answer.
  8. Run. Re-run the evaluation on every change to models, prompts or chunking. Output: a score report per release.

How quality is measured

Each release is scored on the same evaluation set.

Measure Question it answers What a low score points to
Recall at k Did the right passage appear in the top results? Parsing, chunking or search settings
Ranking position How high did the right passage rank? Re-ranking or metadata filters
Faithfulness Is every claim supported by a cited passage? Prompting or too many weak passages
Correct refusal rate Did it decline when the documents had no answer? Refusal instructions or thresholds
Permission tests Did any user retrieve a restricted document? Access mapping or filters
Citation accuracy Does each citation point to a passage that supports the sentence it sits on? Citation prompting or passage boundaries
Answer correctness Does the answer match the reference answer and cover all of it? Retrieval gaps, too few passages or the model choice
Latency and cost per answer How long until the first words appear and the answer completes, and what did it cost, at expected load? Too many passages, re-ranking cost, model size or no streaming

Model-graded scoring is cheaper than human review, but it is checked against a human-labeled sample before anyone trusts it.

How the model, embeddings and store are chosen

The embedding model, the vector store and the generation model are three separate choices. The embedding model is the one to settle early, because changing it later means re-embedding the whole collection. It should be tested on your own documents and languages, not picked from a leaderboard.

For generation, a hosted model (OpenAI, Anthropic, Google or Mistral, for example) or an open-weight model in your own cloud both work, and the evaluation set picks between them. Stores such as PostgreSQL with pgvector, OpenSearch or a dedicated vector database can be used.

Where your data and embeddings live

Source code repositories and cloud accounts are set up in your name, so the index, embeddings and logs sit in your own account. Treat embeddings and indexes with the same protection as the source documents: OWASP lists embedding inversion, where stored embeddings are inverted to recover source text, among vector and embedding weaknesses (OWASP, 2026). For EU, UK, UAE or Saudi data, agree the hosting and model-processing regions with your counsel during the source audit.

What goes wrong with RAG, and the controls

OWASP's 2026 Top 10 for LLM applications includes prompt injection (LLM01:2026), sensitive information disclosure (LLM02:2026) and vector and embedding weaknesses (LLM09:2026) (OWASP, 2026). The table below maps those and the everyday failures to controls.

Risk Control
Wrong passage retrieved, confident wrong answer Evaluation set, hybrid search, re-ranking, citations, refusal when support is weak
User sees restricted content Permission filter applied inside the index query at chunk level, tested, not a post-retrieval filter
Stale answers after a policy changes Incremental sync, deletions removed, document dates shown
Instructions hidden inside a retrieved document Retrieved text treated as data, no tool access in a pure RAG system, links and images in answers limited to cited sources so injected text cannot send data out through a URL, sources ranked by who can edit them, output checks; no complete defense exists
Personal data sent to a model provider Redaction where feasible, provider terms checked, data processing terms checked before launch
A person asks for their data to be erased Deletion runs through source chunks, embeddings, answer caches and traces, and is tested like a document deletion; how the law applies is agreed with your counsel
Cost spikes from long contexts Limits on passages per answer, caching, spend caps

What to ask a RAG development company

  • How will you report retrieval recall and faithfulness during our pilot, and how will the evaluation set be built?
  • How are permissions mirrored from our systems, and how do you test them?
  • What is the cost per answer at our volume, and which line dominates it?

If your documents sit in systems with no clean export or no reliable access rules, fix that first with data engineering for the underlying sources. Our code ownership and security terms explain how access to your data is handled. When you have a document set and ten real questions, send us your document set and questions.

Questions buyers ask

What is the difference between RAG and fine-tuning?

RAG gives the model knowledge at question time by retrieving passages from your documents, so answers change as soon as the documents change. Fine-tuning changes how a model behaves, such as its tone or output format, and it does not keep facts current. Most projects that need answers from company knowledge start with RAG and only consider fine-tuning if a format problem remains.

Can the system show where each answer came from?

Yes. Each answer cites the passages and documents it used, with a link back to the source, so a reader can check it in one click. When the retrieved passages do not support an answer, the system is built to say it cannot find one rather than guess. Citation accuracy is scored on the evaluation set.

How do you stop staff from seeing documents they are not allowed to see?

Access rights are copied from the source systems into the index as metadata, and every search query is scoped to the requesting user's rights inside the index, so restricted passages are never retrieved. The evaluation includes tests where a user tries to retrieve documents outside their access.

How accurate will it be?

Nobody can give an honest percentage before measuring on your documents. Accuracy is measured on an evaluation set of real questions with known source passages: retrieval recall, answer faithfulness and correct refusals. Be wary of any vendor that promises zero hallucinations.

How do you keep answers current when documents change?

The index syncs incrementally from each source: new and edited documents are re-processed, and deleted ones are removed so they stop appearing in answers. The sync schedule is set per source, from near real time for tickets to nightly for slower stores.

Does our data leave our cloud or get used to train models?

The index, embeddings and logs sit in a cloud account in your name. If a hosted embedding or generation API is used, your documents are sent to it at indexing time, and questions and retrieved passages at answer time, under that provider's terms for training, retention and region. Models served through your own cloud account, or open-weight models you host, keep that processing inside your account. Terms and regional model availability differ, so ask for the provider terms that apply to your build to be named in the written scope.

What does a RAG system cost to run each month?

Run cost is driven by model tokens per answer times answers per month, plus embedding new and changed documents, vector storage, hosting and logging. Keyhole Software puts a RAG-powered agent at $500 to $2,500 a month. Your figure depends on volume, passage count per answer and model choice, so ask for the calculation with your expected traffic.

Can it handle Arabic and English documents?

It can, but quality depends on the embedding model and the generation model chosen, and both vary by language. Mixed Arabic and English collections should be tested with real questions in each language, including questions asked in one language about documents written in the other, before a model pair is chosen. Keyword search also needs an Arabic-aware analyzer that normalizes letter forms and diacritics, and scanned Arabic PDFs need OCR tested on Arabic script.

Who owns the index, prompts and evaluation set?

You own the code and intellectual property we write for you, assigned in the contract, and that covers prompts, pipeline code and the evaluation set. Repositories and cloud accounts are set up in your name, so the index and its data stay under your control from the start.

Sources

  1. Keyhole Software Agentic AI Development Cost in 2026: Pricing by Complexity, Approach, and Cost Driver Accessed November 24, 2026
  2. Magora UK Software Development Pricing 2026: Day Rates Accessed November 24, 2026
  3. OWASP Gen AI Security Project OWASP Top 10 for LLM Applications 2026 Accessed November 24, 2026
  4. OWASP Gen AI Security Project LLM09:2026 Vector and Embedding Weaknesses Accessed November 24, 2026

What do you need built?

Start with the system you have and the change you want to make. We reply with questions, not a pitch.

Discuss your project