onema
AI solutions
MVP
Web development
Mobile apps
UX/UI design
Branding
Find out your project cost
office@onema.ru
Questions and suggestions
Get a cost estimate

LLM, RAG and AI agents: what’s the difference? Explained in five minutes

LLM is the brain, RAG is the knowledge, and an AI agent is the hands. An engineer explains how the three main AI technologies differ and how they work together in a single product.
Marina B.
QA Lead at onema
LLM, RAG and AI agents: what's the difference — explained in five minutes — illustration for an onema article
An LLM is a language model: the “brain” that generates text. RAG is a way of connecting your data to that brain so it answers based on facts rather than making things up. An AI agent is a setup that gives the brain a goal and tools, so it doesn’t just answer but acts: searching, checking, processing. These aren’t competing technologies but three layers of a single product: brain → knowledge → hands.

That's the formal definition. Now, here's how I sketch it for clients on a napkin.

One employee, three levels of upgrade


Imagine you’ve hired a brilliant polymath. They can talk expertly on any subject and have read half the internet, but it’s their first day at your company and they know nothing about it.

That’s an LLM. It can talk but doesn’t know your data. Ask it “what do we have in stock?” and it will either honestly be at a loss or, worse, confidently make up an answer. We have a separate article on why a model makes things up, which is called hallucination.

Now you’ve given the polymath access to a database: the catalogue, documents, procedures. Before each answer, they check it first and respond based on facts, backed by a source.

That’s RAG. The same brain plus your knowledge. It’s already useful: it answers customers about your products and staff about your procedures. But it still only answers.

And finally, you’ve given them authority and tools: access to systems, the right to place orders, create requests and send emails. Now the phrase “put together a basket for dinner” ends not with advice but with a ready basket.

That’s an AI agent. Brain + knowledge + hands. It plans the steps, calls tools, checks the result, and comes back with the task done rather than with text about it.

Three layers: LLM (talks) → + RAG (knows your data) → + agent (takes action). Brain → knowledge → hands.

How the three layers coexist in one product


Sigma.AI, the assistant we built for a grocery marketplace, uses all three layers, and it clearly shows which layer is responsible for what.

A customer writes: “what can I cook with chicken and mushrooms?” The RAG layer finds suitable recipes in a database of 1,155 items and checks the ingredients against stock, so the answer only includes dishes that can actually be made from what’s available. The LLM layer turns this into a natural reply. And the agent layer does what matters most for the business: with a single tap, it turns the recipe into a filled basket with real products and prices.

And here’s a counterintuitive fact that saves our clients a noticeable amount of money: a significant share of requests in this setup never reach the model at all. Standard scenarios, such as curated selections and quizzes, are handled by deterministic logic and caching in 4–6 seconds at zero token cost. The brain is the most expensive part of the system, and a good engineer only switches it on where there’s no way around it.

How to tell what you actually need


Over years of projects, I’ve arrived at a simple diagnostic question: what should happen after the answer?

If nothing, you need an LLM with a good prompt: text generation, document summaries, draft replies. If the answer has to be based on your data, you need RAG: a support knowledge base, a catalogue assistant, documentation search. If an action has to follow the answer (an order, a request, an email, a booking), you need an agent.

The good news: these aren’t three separate projects but one ladder. Products almost always start at the RAG level, which launches within a few weeks and delivers value straight away, and agent scenarios are added iteratively to a system that’s already working. That’s exactly how Sigma.AI grew: from catalogue-based selections to an agent with its own model and voice input.
LLMRAGAI agent
What it isBrain: generates textBrain + your knowledgeBrain + knowledge + hands
When you need itNothing needs to happen after the answerThe answer has to be based on your dataAn action has to follow the answer
ExamplesText generation, document summaries, draft repliesSupport knowledge base, catalogue assistant, documentation searchOrder, request, email, booking

A real-world example

Sigma.AI, an assistant for the Sigma.Market grocery marketplace, builds a basket from items that are in stock.
Not sure which layer you need?
Describe your task in the estimate form and we'll map it onto this ladder and tell you honestly which rung to start from. More on each level in the articles about LLMs, on RAG and on AI agents, and you can see a real-world example in the Sigma.AI case study.

FAQs

Cost calculation
Tell us where your product has hit a wall, in the estimate form
After the audit, we'll tell you what to migrate, what to keep and how much it costs
More articles