Lesson 13 of 13 · Using AI well
Capstone: an AI assistant end to end
Put the whole course together by following one question through a realistic internal IT support assistant: sign-in and permissions, the system prompt, retrieval from a vector database, a tool call through MCP, a guarded action that needs approval, the answer with citations, and how the team measures and improves it. Ends with a review checklist you can use on any AI feature.
The scenario
An internal IT help assistant for 5,000 employees. It answers questions from the IT knowledge base, can look up the employee's own tickets and devices, and can start a small set of actions (reset MFA, open a ticket) with the employee's confirmation.
The architecture
Employee (browser, signed in with company SSO)
│ "My authenticator app is on my old phone. How do I move it?"
▼
Assistant application (the "host")
├─ identity: who is this, which groups → used for EVERYTHING below
├─ system prompt: role, rules, tone, "answer only from sources, cite them"
├─ RAG: embed question → vector DB (permission filter: user's groups) → top 5 chunks
├─ MCP client ──► IT systems MCP server
│ tools: get_my_devices (read), get_my_tickets (read),
│ open_ticket (write, confirm), reset_my_mfa (write, confirm)
├─ model: hosted LLM in the company's approved region (no training on data)
├─ guard-rails: secret/PII filter on output, step & cost limits, logging
└─ feedback: 👍/👎 + "report a wrong answer"
Following one question
1. Sign-in. The app knows it is employee Asha, in groups staff and india. Every later step uses this identity, never a shared super-user account.
2. Prompt assembly. The app builds the request: system prompt + Asha's question + the tool list (lesson 3, 8).
3. Retrieval. The question is embedded and searched in the vector database with a filter for documents visible to staff and india. It finds the "Moving your authenticator to a new phone" article and the "Lost phone" article (lessons 5–7).
4. A tool call. The model wants to know whether Asha's new phone is already enrolled, so it calls get_my_devices. The MCP server checks the call is for Asha's own devices, queries the device system with Asha's scoped token, and returns two phones (lesson 10).
5. Reasoning and a proposed action. The model sees the old phone is still the only registered authenticator and the new phone is enrolled. It writes the steps from the article and proposes reset_my_mfa so she can register the new phone.
6. Approval. The application, not the model, sees reset_my_mfa is a write action and shows Asha: "Reset your MFA? You will need to set up your authenticator again within 15 minutes." She confirms. The application checks policy (allowed for this user, not done in the last 24 hours), runs it and logs it (lesson 8, 12).
7. Answer. Steps to set up the new phone, with citations [1] and [2] linking to the articles. Output filters check it contains no secrets or other people's data.
8. Learning. Asha clicks 👍. The conversation (with personal data handled per policy) can be sampled for review.
It's a well-run help desk. The receptionist (the app) checks your badge first, looks only in the folders you're allowed to see, asks the clever assistant (the model) to write the answer from those folders, lets it look up your devices, but makes you say "yes" before anything gets changed, and writes everything in the logbook.
How the team keeps it good
- Evaluation set: 150 real questions with expected sources and must-include points, plus 30 adversarial ones (injections in tickets, requests for other people's data). Run on every change.
- Metrics: right source retrieved, answer correct, cites sources, says "not found" correctly, escalation rate, cost per conversation, time to first token.
- Content ownership: each knowledge-base area has an owner; stale articles are the main cause of wrong answers.
- Incidents: a wrong or harmful answer is handled like any production incident: capture the conversation, find the failing layer (retrieval, prompt, tool, model), add the case to the evaluation set.
Where each lesson appears
| Lesson | In this design |
|---|---|
| 1–2 Models and LLMs | The hosted model generating the answer |
| 3 Prompts and context | System prompt, history, tool list, retrieved chunks |
| 4 Why models fail | Grounding and citations reduce made-up steps |
| 5–7 Embeddings, vector DB, RAG | Knowledge-base search with permission filters |
| 8 Tools | get_my_devices, reset_my_mfa |
| 9 Agents | A small loop: look up, decide, propose |
| 10 MCP | The IT systems server used by this and other AI apps |
| 11 Choosing a model | Hosted in an approved region; smaller model for routing |
| 12 Risks and evaluation | Approvals, filters, logging, evaluation set |
Your turn
Pick an AI feature you use or are asked to build. Walk it through the checklist in the cheat sheet. For each row, write one sentence. The empty rows are your risks.
Recap
- A real AI feature is identity + prompt + retrieval + tools + model + guard-rails + evaluation.
- The application enforces permissions and approvals; the model proposes.
- Quality is managed like any production system: tests, metrics, owners and incident handling.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.