Lesson 1 · Module 1: System Prompts That Control Agents and Cut Cost
How an AI agent works: model, instructions, tools and memory
- Name the four parts of every AI agent
- Explain what each part does, with a shop example
- Follow one customer message through a real agent loop
Why this matters
Many people connect an AI chatbot to a business inbox and expect it to look after customers. Within a day it quotes a price that does not exist or books a slot that is already full. Every AI agent is built from the same four parts. Once you can name them, you can tell what is missing before a paying client finds the mistake, in any builder: a no-code tool where you build automations by connecting boxes on a screen, Make, Zapier or code.
Key ideas
- The model only reads and writes. The model takes text in and gives text out. It knows language and general facts, but nothing about your business, and it cannot open a calendar or send an email by itself.
- Instructions are a job description. The instructions set the agent's role, goal, rules and reply format. They are sent again with every message, because the model keeps nothing from one call to the next.
- Tools are actions your workflow runs. The model only writes a request, such as "check the calendar for Friday at 9". Your workflow carries out the real action and passes the result back. The agent can only do what you wired up.
- Memory is stored text you send back in. Short-term memory is the messages in the current chat. Long-term memory is customer records and past orders. Both are kept by your workflow, not by the model.
- One business, four parts. Here is how a dental clinic's booking agent breaks down:
| Part | Dental clinic agent |
|---|---|
| Model | Claude or GPT |
| Instructions | "You book cleanings. Never give medical advice. Send emergencies to the front desk." |
| Tools | find free appointment, book appointment, send reminder |
| Memory | this chat's messages, the patient's last visit date |
Try it before you watch
A gym's agent tells a member "Yes, Thursday's yoga class has space!" but the class was full. Which of the four parts was missing, and what would fix it?
Show answerHide answer
A tool, or the facts it needed. The agent had no tool to check class bookings and no class list in its instructions, so it guessed. A "check class spaces" tool that the workflow runs would fix it. This shows that the model only knows what you give it or let it look up.
Words to know
- large language model (LLM): a program trained on huge amounts of text that predicts which words come next. It is the "brain" of the agent.
- system prompt: the hidden instructions the model reads before every customer message.
- tool: one action the workflow can perform when the model asks, like booking a slot.
- workflow: the chain of automated steps that connects the model, the tools and the stored memory.
- hallucination: a confident, well-written answer the model has simply made up.
What to watch for
- Watch the animated diagram of one message moving through all four parts. Notice that the arrow to the tools starts at the model, but the action happens outside it.
- In the short code example, notice that the "model" only returns a request, and the surrounding code does the booking and saves to memory.
- In the common mistake slide, note the two fixes for a guessing agent: put the fact in the instructions, or give it a tool to look the fact up.
Learn it with your tutor on the live board
Key points from the video
Forty messages before breakfast
- A small online shop wakes up to 40 unread messages
- Questions, bookings, price requests, one angry refund
- An AI agent can answer most of them while you sleep
- To build one, you first need to know how it works
What you will learn
- Name the four parts of every AI agent
- Explain what each part does, with a shop example
- Follow one customer message through a real agent loop
The four parts of an agent
- Model: reads and writes
- Instructions: how to behave
- Tools: actions it may take
- Memory: what it knows
layout: side
direction: TB
components:
cust: {kind: user, label: Customer}
instr: {kind: file, label: Instructions}
model: {kind: llm, label: Model}
tools: {kind: service, label: Tools}
mem: {kind: database, label: Memory}
links: [cust->model, instr->model, model->tools, model->mem]
steps:
- at: "It all starts when"
show: [cust]
- at: "sits the model"
show: [cust, model]
- at: "the written instructions"
show: [cust, model, instr]
- at: "Then come its tools"
show: [cust, model, instr, tools]
- at: "finally there's memory"
show: all
- at: "travel through the agent"
flow: ["cust>model: question", "instr>model: rules", "model>tools: lookup", "tools>model: result", "model>mem: save note", "model>cust: reply"] Part one: the model
- A large language model (LLM), like GPT or Claude
- Predicts the next words, like a very smart autocomplete
- Knows language and general facts, not your shop
- Can't see your calendar or send anything on its own
Part two: the instructions
- Also called the system prompt
- Like a job description for a new hire
- Role, goal, rules and reply format
- Sent with every single message
Part three: the tools
- A tool is an action your workflow can run
- The model only asks for a tool; it doesn't run it
- Shop tools: check calendar, book slot, create invoice
- The result goes back to the model to write the reply
Part four: memory
- The model forgets everything between calls
- Short-term memory: this conversation's messages
- Long-term memory: customer records, past orders
- Your workflow stores it and sends it back in
Worked example: one booking, in code
calendar = {"Tue 10:00": None,
"Tue 14:00": "Ana"}
memory = []
def fake_model(msg):
# stands in for the real AI model
if "book" in msg:
return {"tool": "check_slot",
"slot": "Tue 10:00"}
return {"reply": "Happy to help!"}
def check_slot(slot):
return calendar[slot] is None
msg = "Can I book Tuesday at 10?"
memory.append(("customer", msg))
step = fake_model(msg)
if step.get("tool") == "check_slot":
if check_slot(step["slot"]):
calendar[step["slot"]] = "New client"
answer = "Booked for Tue 10:00!"
else:
answer = "Sorry, that slot is taken."
else:
answer = step["reply"]
memory.append(("agent", answer))
print(step)
print(memory)
print(calendar) The whole loop at Lina's shop
- Customer asks to book for two on Tuesday
- Agent (model + instructions) reads it with memory
- It asks for a tool: check the calendar
- It confirms and saves a note
Common mistake: asking the model to just know
- Expecting the model to know prices or free slots
- No tool and no data means it guesses
- A confident guess is called a hallucination
- Fix: give it a tool or the facts in its prompt
Recap
- Model reads and writes text, and knows nothing about your business
- Instructions shape behaviour; tools take actions
- Memory is stored text your workflow sends back in
Your exercise
- Pick one small business you know
- Write its agent's four parts on one page
- Model, instructions (3 rules), tools (3 actions), memory (what to store)
- Bring it to the next lesson
Transcript
Forty messages before breakfast. Picture Lina. She runs a small online shop selling handmade candles, and she also books candle-making workshops. Every morning she opens her phone and finds about forty new messages. Some ask about shipping, some want to book a workshop, a few ask for a price on a wedding order, and one is an angry refund request. Answering all of them takes her two hours before she has made a single candle. What if a helper answered most of those messages overnight, booked the workshops, and left only the tricky ones for her? That helper is an AI agent. In this lesson we'll open one up and look at the parts inside, so you know exactly what you're building.
What you will learn. Here's the plan for the next few minutes. First, you'll learn the four parts that every AI agent is made of, whether you build it in n8n, Make, Zapier or with a few lines of code. Second, you'll see what each part actually does, using Lina's candle shop as the example every time. Third, we'll follow one real customer message, a workshop booking, through the full loop, step by step, and even run a tiny version of it. You don't need any background in machine learning for this. If you've ever trained a new employee, you already understand most of it.
The four parts of an agent. Every agent you'll build in this course has the same four parts. It all starts when a customer writes in. At the centre sits the model, the part that reads text and produces text. Feeding into it are the written instructions, which tell it who it is and how to behave. Then come its tools, the actions it's allowed to take, like checking a calendar or creating an invoice. And finally there's memory, what the agent knows about this customer and this conversation. Now watch one message travel through the agent. The question comes in, the model reads its rules, calls a tool to look something up, gets the result, saves a note, and sends a reply.
Part one: the model. The model is the brain of the agent. It's a large language model, or LLM, which simply means a program trained on huge amounts of text until it got very good at one thing: predicting which words come next. Think of the autocomplete on your phone, but strong enough to write a polite, accurate reply to a customer. Because it has read so much, it knows grammar, tone and plenty of general facts. But here's the important part: it knows nothing about Lina's shop. It doesn't know her prices, her workshop dates or her refund policy, and it can't open her calendar or send an email by itself. On its own, it can only read and write text.
Part two: the instructions. The instructions are how you turn a general model into Lina's assistant. They're usually called the system prompt, which just means the hidden text the model reads before every customer message. Think of it as the job description you'd hand a new hire on day one. It says who they are, for example the friendly assistant of a candle shop. It says what the goal is, like answering questions and booking workshops. It lists the rules, such as never promising refunds and passing angry customers to Lina. And it says how replies should look. Remember that the model reads this whole job description again with every single message, because it doesn't keep it from last time. We'll write these properly in the next lesson.
Part three: the tools. Tools are what let an agent do things instead of just talking. A tool is any action your workflow can perform: check the workshop calendar, book a slot, look up an order, create an invoice. Here's the part people often miss. The model never runs the tool itself. It writes a short request, something like "please run check calendar for Tuesday at ten". Your no-code workflow, say in n8n, sees that request, runs the real action, and passes the result back to the model. Only then does the model write the reply to the customer. This is what makes agents safe to sell: you decide exactly which tools exist, so the agent can only take the actions you wired up.
Part four: memory. The last part is memory, and it surprises most people. The model forgets everything the moment it finishes a reply. If a customer says "make it two people" in their second message, the model has no idea what "it" refers to, unless you send the first message again. So your workflow keeps the memory. Short-term memory is like a notebook on the front desk: the messages in this conversation, sent back in each time. Long-term memory is like a filing cabinet: a customer sheet or database with past orders and preferences, looked up when needed. Once you see that memory is just stored text you send back in, agents stop feeling like magic.
Worked example: one booking, in code. Let's make this concrete with a tiny version of the loop. You don't need to read this code line by line; just follow what each piece does. In n8n, these same steps would simply be boxes in a workflow. The calendar is a dictionary, which is just a lookup table of time slots and names: ten o'clock on Tuesday is free, two o'clock is taken by Ana. The memory is a list, an ordered list of messages, and it's our notebook. A function is a named set of steps, and the fake model function stands in for the real AI: when it sees the word book, it asks for the check slot tool instead of answering. Our code, playing the role of the workflow, runs that tool, books the free slot, and writes the answer. Both the customer's message and the agent's reply go into memory. In the output you can see the tool request the model made, the conversation saved in memory, and Tuesday at ten now marked for the new client.
The whole loop at Lina's shop. Let's step back and see the whole loop as a scene. On the left is the customer, relaxing at home and typing, can I book a workshop for two on Tuesday? In the middle is the agent, which really means the model plus its instructions, reading that message alongside the earlier chat pulled from memory. It decides it needs to check availability, so it asks for a tool. On the right is the calendar, the real system your workflow checks and updates. The answer flows back to the agent, which writes a friendly confirmation and saves a note for next time. Four parts, one smooth loop, and Lina is still asleep.
Common mistake: asking the model to just know. Here's the mistake almost every beginner makes. They connect a model to their inbox, write "you are a helpful booking assistant", and expect it to know which slots are free and what a wedding order costs. It doesn't, so it guesses. And it guesses confidently, in perfect sentences. A confident answer that's simply made up is called a hallucination, a bit like a new employee who'd rather invent an answer than admit they don't know. The customer then shows up for a workshop that's already full. The fix is always the same: if the agent needs a fact, either put that fact in its instructions or give it a tool to look the fact up.
Recap. Let's wrap up: four parts, three takeaways. First, the model is a powerful reader and writer, but it knows nothing about your business and can't act on its own. Second, the instructions and the tools work as a pair: instructions turn the model into your assistant with a role, a goal and rules, while tools are the actions your workflow runs when the model asks. Third, memory isn't inside the model at all. It's text you store, like conversation history and customer records, and send back in every time. Model, instructions, tools and memory: keep these four parts in mind and any agent, in any tool, becomes easy to read.
Your exercise. Now it's your turn, and you don't need any software for this one. Pick a small business you know well: a hair salon, a tutor, a photographer, maybe your own side project. On a single page, draw four boxes. In the model box, write which model you'd use, such as GPT or Claude, and one thing it must not be expected to know about this business. In the instructions box, write the agent's role and three rules it must follow. In the tools box, list three actions it would need, like book appointment or send invoice. In the memory box, write what it should remember about each customer. Keep that page, because in the next lesson we'll turn your instructions box into a real system prompt.
Explore the animation
The animations from the video, exact and live: play them, pause, drag the slider or jump to a step at your own pace.
Loading the animation...
Answer every question, then check. 70% passes; you can retry as often as you like.
Lesson summary
- Reading
- Video watched
- Quiz passed (70%)
- Model reads and writes text, and knows nothing about your business
- Instructions shape behaviour; tools take actions
- Memory is stored text your workflow sends back in