06

Learning/AI Basics/Chapter 6

Chapter 6 · Families of AI

RAG, assistants and agents

On its own, a language model answers from memory. In hospitals, answers must come from the patient's record, from current guidelines and from local procedures. Retrieval-augmented generation (RAG) connects the model to those sources. Agents go one step further and let the model take actions.

⏱ 4 min read⚡ Takeaways: 30 s❓ Self-check includedinShare on LinkedIn
In a hurry? The takeaways30-second read
  1. RAG grounds a language model in current, local documents and makes sources checkable.
  2. Its weak point is retrieval: missing or badly indexed documents lead to silent omissions.
  3. Prompts are configuration: they must be fixed, versioned and tested.
  4. Agents act, so they need permissions, logs, approval points and an off switch.

Got these four points? You have the essentials. Read on for the explanations, examples and traps.

Retrieval-augmented generation (RAG)

Questionfrom the user
→
1. Retrievesearch the sourcesPatient record · Procedures · Guidelines · Literature
→
2. Augmentdocuments + question + rules
→
3. Generateanswer + cited sources
Retrieval-augmented generation. The quality of step 1 largely decides the quality of the answer.
  1. Retrieve. When a question arrives, a search component finds the most relevant documents: notes from the patient's record, a hospital procedure, a guideline, articles.
  2. Augment. Those documents are placed in the model's context window with the question and instructions such as “answer only from these documents and cite them”.
  3. Generate. The model writes the answer, ideally with references to the documents it used, so the clinician can check them.

What RAG improves, and what it does not

RAG improves

  • Answers are grounded in current, local documents
  • Sources can be shown and checked
  • No need to retrain the model when documents change
  • Access can follow the user's permissions

RAG does not solve

  • If retrieval misses a document, the answer silently omits it
  • The model can still misread or misquote a source
  • Contradictory or outdated documents produce confused answers
  • Poor indexing (scanned PDFs, missing document types) creates blind spots
🏥In the hospital: the weak point is often the plumbing

When a hospital pilots a record assistant built on RAG, a typical pattern is that the most serious complaints concern omissions rather than invented facts: a document type that was never indexed, a report that arrives through another interface, a scanned letter the search cannot read. Before blaming the model, check what the retrieval step can actually see.

Prompts and system instructions

The text that tells the model how to behave is the prompt. In a hospital product, most of it is hidden: a system prompt written by the developer sets the role, the tone and the rules (“cite sources”, “do not give dosing advice”, “answer in the user's language”). The user's question is added on top. Small changes to prompts can change behaviour significantly, which is why a validated product fixes and versions its prompts like any other configuration.

⚠Watch out: prompt injection

Text inside a document can contain instructions aimed at the model (“ignore your rules and…”). If an assistant reads external documents or emails, a malicious or simply odd document can change its behaviour. Well-designed systems treat retrieved text as data, not as instructions, and restrict what the assistant can do.

From assistants to agents

An assistant answers. An agent also acts: it can call tools such as a search engine, a calculator, the scheduling system or an order-entry form, decide on the next step, and chain several steps to complete a task. Examples include agents that prepare prior authorisation files, schedule appointments by phone, or pre-fill orders for a clinician to sign.

Level 1Assistant

Reads and answers; the human does everything else.

Human checks the answer
Level 2Drafting assistant

Prepares a document or order; the human edits and signs.

Nothing leaves without signature
Level 3Agent with approval

Executes multi-step tasks; asks before irreversible actions.

Permissions, logs, approval points
Level 4Autonomous agent

Acts alone within a defined scope.

Strict scope, monitoring, kill switch; rare in care

The more an AI acts, the more important become permissions (what can it access and change?), traceability (logs of every action) and the ability to stop it.

Self-check 6

An assistant's answer about a patient's allergies cites three documents, but the most recent allergy record is missing. Is this a hallucination or an omission, and where in the RAG chain would you look for the cause?

Show the answer

It is an omission. Look at retrieval: was the latest allergy record indexed, was it available through the interface, was it filtered out by the search, or excluded by the permissions or date range?

If you can answer out loud in a minute, you have understood the chapter.

Found this useful?Share it with your team or your network.
inShare on LinkedIn

Adapted from AI Basics for Hospital Professionals, edition 1, November 2026. Educational content only: not legal, regulatory or clinical advice, and no product recommendation. Facts and dates checked as of November 2026; verify regulatory dates at the official sources.