How the AI pieces fit together: agents, RAG, MCP and reasoning models on one map

Updated 2 Nov 2026

You've heard the words: agents, RAG, MCP, reasoning models, vector databases. Each one makes sense alone, but how do they connect? This page puts them on one map. A language model sits in the middle, and each piece around it adds one ability: thinking harder, looking things up, or taking action.

Language modelThe brain. It predicts the next words, so it can write, summarise and answer. Context windowWhere it all meets: everything the model can see at once. Your question, the passages it found, tool results and memory notes all land here.
Tap any piece for its plain-English definition.

The short version. A language model uses what it learned in training plus whatever is in front of it in the conversation. On its own, it can't see your company's files, check live news or do things in other apps. Each branch adds one ability: thinking harder, looking things up, or taking action. Many AI assistants now combine all three.

One request, every piece

Follow one real-life request from start to finish. At each step, the box on the right shows what is actually happening at that moment.

  1. 1

    You ask

    You type one sentence into the assistant at work. You say what you want, not how to do it.

    Large language model

    What it looks like

    Find out what customers complained about most in October, and email a summary to my team.

  2. 2

    Takes action

    The agent makes a plan

    The agent turns your goal into steps. Then it works in a loop: act, check the result, adjust, until the job is done. It marks the step that affects other people, so it will stop and ask you first.

    AI agent

    What it looks like

    1. Find October's complaint tickets
    2. Group them by topic
    3. Write a short summary
    4. Email it to the team (ask first)
  3. 3

    Looks it up

    It looks up the tickets by meaning

    The search is turned into a list of numbers (an embedding). The vector database keeps only October tickets, then returns the closest matches, so "my parcel never came" is found even though it never says "complaint".

    RAGEmbeddingVector database

    What it looks like

    "customer complaints"
    → [0.12, −0.48, 0.91, 0.07, … hundreds more]

    Filter: October only (418 tickets)

    Closest tickets in the vector database

    • #4182My parcel never came, it has been two weeks0.91
    • #4207Still waiting for my order0.88
    • #4311I was charged twice for one order0.86
    • #4350The app logs me out every time0.84

    … 46 more: the 50 closest. Scores show how close the meaning is, not the chance a ticket is right. Made-up numbers.

  4. 4

    Everything goes into view

    The model can only work with what is in its context window. So the agent puts in the instructions, your request, the 50 tickets the search returned (not every ticket in the system) and the tools it may use.

    Context window

    What it looks like

    • InstructionsYou are a helpful work assistant. Ask before sending anything.
    • Your requestFind out what customers complained about most in October…
    • Found by searchThe 50 most relevant October tickets
    • Tools it may usesend_email, read_calendar

    A small part of the window used

  5. 5

    Thinks it through

    It works it out

    A reasoning model thinks before it answers. It sorts the tickets into topics and checks its own sums before it writes a word of the summary.

    Reasoning modelChain of thought

    What it looks like

    1. Sort the 50 tickets into topics.
    2. Delivery 21 · Billing 12 · Login 9 · Other 8
    3. Check: 21 + 12 + 9 + 8 = 50 ✓
    4. Delivery is the biggest group. Many mention the same courier.
    5. Lead with delivery, and say this is from the 50 most relevant tickets.

    A simplified explanation of the working, not the model's actual hidden reasoning.

  6. 6

    Takes action

    It sends the email, after you approve

    The model cannot send email itself. It requests the email tool through function calling. The assistant app routes that request to the email app's MCP server, which sends the email only after you approve, because this step reaches other people.

    Function callingMCP

    What it looks like

    Email app, connected through MCP

    send_email(
      to: "support-team@yourshop.com"
      subject: "October complaints: delivery is top"
      body: "From the 50 most relevant October complaints: delivery 21, billing 12, login 9, other 8…"
    )

    Send this email to support-team?

    You approved. Email sent.

  7. 7

    Takes action

    It remembers for next time

    It saves a short note outside the model. Next month the note is put back into the context window, so it already knows who gets the summary.

    Agent memory

    What it looks like

    The monthly complaints summary goes to support-team@yourshop.com. Lead with the biggest topic.

    Next month you just say "Do the complaints summary."

An illustrative example: the shop, tickets and numbers are made up. Real products differ in the details, but they use the same pieces.

  • Only the access it needs. Give an agent only the tools and data it is allowed to use. Reading is low risk; sending messages, changing records or paying should need checks and your approval.
  • Need exact totals? RAG finds the most relevant examples, not every record. To count all 418 October tickets, an agent would call a reporting tool instead.

Which piece fixes what

When an AI tool lets you down, the problem usually points to the missing piece.

  • "It makes up facts about our company or recent events"

    Give it sources to read before it answers. If the search finds the wrong passages, the answer can still be wrong. RAG

  • "It gets multi-step maths or logic wrong"

    Use a model that thinks before it answers. Reasoning model

  • "It tells me what to do but cannot do it"

    Connect it to tools and let it act, with your approval. AI agent + MCP

  • "It forgets what I told it last week"

    Turn on memory, or keep your key details in a project. Agent memory

  • "It loses track of a very long document"

    Split the document, or use a model with a bigger context window. Context window

Easy to mix up

  • RAG vs Fine-tuning

    RAG hands the model something to read when you ask. Fine-tuning changes the model itself through extra training. For facts that change, RAG is usually cheaper and easier to keep up to date.

  • Context window vs Agent memory

    The context window is short-term: what the model can see right now. Memory is notes saved for later, which are put back into the context window when they are needed.

  • Function calling vs MCP

    Function calling is the model asking for a tool to be used, and it works without MCP. MCP is one shared standard for offering tools and data, so AI apps that support it can connect to the same MCP server. Not every app supports every MCP feature.

  • AI agent vs Agentic AI

    Related, but not the same. An AI agent is one system that does tasks for you. Agentic AI is the wider approach of building AI that plans, decides and acts towards goals.

Go deeper with the illustrated guides: how AI chatbots work, RAG explained, AI agents, explained simply and the AI tech stack.

How we wrote this

Every piece on the map links to its entry in our glossary, which explains it in plain English. The worked example is illustrative: real products differ in the details, but they use the same pieces.

← All guides