Stations 4–6 · Prompt like a pro → Give AI your own memory → Build an agent that acts.
Length: ~75 min · You'll need: a laptop + the Session 2 Colab notebook · Ages: high schoolers
4
Station 4 · Prompting
Prompt engineering
Concept · Why it works
Your prompt is the "text so far"
Callback to Session 1: the model reads the text so far and predicts what comes next. Your prompt is that text — so it steers the guess.
🔑 The core idea
You can't reach in and make the model smarter. You can rewrite the text it's continuing. A sloppy prompt looks like the start of a sloppy answer; a precise one looks like the start of a precise answer.
Concept · Anatomy
Five ingredients of a strong prompt
Role — who should the AI be? ("a patient math tutor")
Task — the one clear action ("explain why the answer is 12").
Context — the facts it must build on (grade, the actual problem).
Format — how the output should look (3 bullets, then a sentence).
Constraints — the rules (under 80 words, no jargon).
Vague
What you type first
"Help me write an email to my teacher about a late assignment." No role, tone, length, or details — the model guesses all of it.
Specific
What gets a usable draft
"You're helping a high-schooler. Short, respectful email to Mr. Lee. I was sick 2 days, missed the essay. Ask for a 3-day extension. Greeting, 3 sentences, sign-off. Polite, not groveling."
Concept · Two power moves
Few-shot & chain-of-thought
# FEW-SHOT — show the pattern, don't describe it:"I got the lead in the play!!" → Happy"My best friend is moving away." → Sad"We lost but I played my best." → ?# CHAIN-OF-THOUGHT — make it show its work:"A $40 shirt, 25% off, then $5 shipping.
Solve it step by step, then the final price."
🔑 Why they work
Few-shot: examples set the pattern the model continues. Chain-of-thought: each written step becomes part of the "text so far," so the next step is predicted on top of real work — not one lucky guess.
🧪 Practical · Colab — Station 4
Weak prompt → strong prompt
Run a vague prompt, then rebuild it with all five ingredients.
Try few-shot: paste 2 labeled examples, then a new one.
Add "think step by step" to a math prompt — watch it get it right.
✅ Test: your strong prompt beats the weak one + chain-of-thought fixed a wrong answer
5
Station 5 · Memory
Give AI a memory (RAG)
Concept · The problem
Brilliant, but with amnesia
Knowledge cutoff — it finished learning on a past date. Ask about last week's game and it wasn't in the text it read.
It never read your world — your class notes, a 40-page PDF, your club's rules. None of that was on the public internet it trained on.
⚠️ Why "just ask it" fails
Because it predicts likely text, when it doesn't know it doesn't stop — it produces a believable, confident, wrong answer. We need to hand it the facts, not hope they're in its memory.
Concept · The RAG loop
Retrieve → stuff → answer
1 · Retrieve
Go fetch the handful of chunks from your own documents most relevant to the question.
2 · Stuff → 3 · Answer
Paste those chunks into the prompt, right above the question. The model answers from them — not from vague memory.
📖 Analogy: the open-book exam
Closed-book forces you to answer from memory — you bluff on what you forgot. Open-book lets you flip to the right page first, then write. RAG turns every question into an open-book exam. Same student, dramatically more reliable.
Concept · Under the hood
Embeddings, vectors & chunks
# An embedding turns meaning into numbers (a vector):
q =embed("How do I get my money back?")
note_a =embed("Refunds allowed within 30 days.")
note_b =embed("The store opens at 9am.")
similarity(q, note_a) # high — same meaningsimilarity(q, note_b) # low — unrelated
🔑 Three pieces, one pipeline
Embeddings = similar meaning gets similar numbers, so it matches by meaning, not shared words. A vector database instantly finds the nearest chunks. Chunking = cut docs into small pieces so each has one clear idea. Bad chunks = bad answers.
🧪 Practical · Colab — Station 5
Build a tiny RAG in code
Embed a few of your own notes into vectors.
Use cosine similarity to find the note closest to a question.
Stuff that note into the prompt and let Gemini answer from it.
✅ Test: your tiny RAG retrieved the right note + answered from it
6
Station 6 · Agents
AI agents
Concept · The difference
A chatbot talks. An agent acts.
Only talks
A plain chatbot
Takes your text, predicts a reply, done. Can't look anything up, run code, or check its own math. One turn of talk.
Takes action
An agent
Same brain, but it can use tools — search, calculate, run code, call apps — and loop until the goal is reached.
🔑 The core idea
The model is still just predicting text — but now some of that text is a command to use a tool, and the tool's result comes back into the conversation so the model can keep going.
Concept · Tools & the loop
Think → act → observe → repeat
# You describe a tool the model may call:toolcalculator(expression) # exact math
user: "What is 2 + 2, then doubled?"
model: CALL calculator("2 + 2")
tool: 4# fed back in
model: CALL calculator("4 * 2")
tool: 8
model: "2 + 2 is 4, doubled that's 8."
🧑💼 Analogy: an intern with tools
A chatbot is an intern answering instantly from memory — no phone, no calculator. An agent is that same intern, now allowed to grab a calculator, look things up, and check files before reporting back. It goes and does the work.
Why this matters
The superpower is also the danger
⚠️ Agents take real actions
A wrong chatbot just says a wrong sentence. A wrong agent might delete the wrong files, email the wrong person, or spend real money. It's still predicting text (Session 1) — so it can be confidently mistaken. Now that mistake can pull a trigger.
Reading & searching = low-risk.
Hard-to-undo actions (delete, send, pay) = human in the loop who approves first.
"It seemed confident" is not a safety check.
🧪 Practical · Colab — Station 6
Give the model a calculator
Define a real calculator tool and describe it to the model.
Ask a math question — watch it call the tool instead of guessing.
Feed the result back and see it finish the answer.
✅ Test: the model called your calculator and used the real result
Session 2 · Wrap-up
What you can now do
Prompt well — Role, Task, Context, Format, Constraints + few-shot & "think step by step."
Give AI your own memory — retrieve → stuff → answer with embeddings & a vector search.
Build an agent — hand the model a tool and let it think → act → observe.
🎟️ Exit ticket
In one sentence each: Name one of the five prompt ingredients. · What does RAG change — the model, or what it sees? · What can an agent do that a chatbot can't?
Next session → Real-World: images & sound, safety, and shipping your first project.
LearnAI Workshop · Session 2 — Building · press S for coach notes