01 FoundationsLesson 4 of 612 minBeginnerHelps to have seen:What an LLM is
Writing the agent's prompt
- + three test conversations
The diagram shows: The text of the call (prompt + message), LLM (the same model), "Where is 4805?" (conversation s01), "50% coupon?" (conversation x10), "I will sue" (conversation x06), Your code (builds the call) and Support rep (receives it with a summary).
Highlighted: The text of the call.
"Where is 4805?" sends to The text of the call carrying "where is 4805?".
The text of the call sends to LLM.
LLM sends to The text of the call carrying ""I have no access"" (faulty data).
Added: three test conversations.
Step 1 of 10: The same model, with no instructions
- What the system prompt is and where it goes
- The four blocks and the mistake each one prevents
- Why a vague instruction becomes a loophole
- What a real prompt looks like, in a file
Conversations that follow the policy with prompt v1, and with each block turned off, across the store's 50 test conversations
Coming soon: I will measure this on the example agent and publish the number with the report.
The whole lesson as textEvery step, to read at once, search or print.
The same model, with no instructions
Three messages from the store's test set reach the model with no instructions at all. The text of the call has only the customer's message.
It answers like any assistant: it does not know it works for the store, promises what the store does not give and handles alone what should go to a person. Every answer sounds polite. None follows the policy.
Without instructions, the model serves the question, not your company.
The system prompt
The is a text that goes before the conversation, in every call. That is where you say who it is, what it can do, what it never does and when to call a person.
It teaches the model nothing new. It changes the text the model reads, like the order data in the lesson about the LLM. Here it has four blocks. In the next steps, you turn off one at a time.
The prompt is the fixed part of the text, written by you.
Role: who it is and who it works for
The role says who it is and who it works for: the store's support rep, who handles orders, exchanges and refunds. The tone comes with it: short sentences, speaks to the customer as "you".
It seems like little, but it is what makes the model act like the store, and not like any chat.
Say who it is before saying what to do.
Rules: what not to do and what to do instead
The rules are the policy written for the model. Write them as rules, not wishes: "do not offer coupons" works better than "try to avoid giving discounts".
And say what to do instead. Here, offer cancellation, which the policy guarantees for delays of more than 5 days. When you can, also say why: the model applies a rule it understands better.
A clear rule says what not to do, what to do instead and why.
When to hand off to a person
The model does not know on its own what is serious for your company. List the triggers: a request to talk to a person, a mention of a lawsuit or Procon (consumer protection), a change of address.
And say what to do when one of them shows up: tell the customer and hand off the case with a two-line summary, so the support rep does not start from scratch.
Knowing when to stop is part of the agent's job.
Examples: show instead of describe
A few short conversations teach format and tone better than a paragraph describing both. Anthropic suggests 3 to 5, varied: examples that are too alike teach patterns you did not want.
And do not take examples from the test set. If the right answer is already in the prompt, the test measures memory, not behavior.
An example teaches format. An example from the test ruins the test.
"Be flexible with the customer"
"Be flexible", "do whatever you can for the customer": the model reads it as permission. When two instructions clash, you do not know which one wins.
Every sentence in the prompt needs a reason. And whatever costs money, like the refund limit, also lives in the code, which checks the amount before running. That is the topic of the lesson on the harness.
The prompt guides. A limit that costs money also lives in the code.
The whole prompt, in a file
This is the lesson's prompt, in a file in the repository. Each block you turned on and off is a section, with a heading.
It lives in a file, and not pasted into the code, so it has versions: when you change a sentence, you can compare it with the previous one and run the same test on both. This is v1. The evals lesson measures where it goes wrong.
A prompt is code: file, version and test.
Even the people who train the model write prompts
What the sources say: since August 2024, Anthropic publishes in its release notes the system prompts Claude uses in its apps. They are long texts, with role, behavior rules, format and what to do in hard cases.
Our reading: even with the model in hand, the product's behavior is written in a prompt, and versioned like any file.
The product's behavior lives in the prompt, and the prompt has versions.
The four blocks to remember
The system prompt is the fixed part of the text the model reads in every call. Each block prevents one kind of mistake, and a vague sentence can undo a rule.
The question that remains: with the same prompt, why does the answer still vary from one time to the next?
Questions in this lesson
- What does the system prompt change?
- The text the model reads before the conversation. The model is the same. The prompt is text that goes into every call.
- Which of these instructions is better?
- "Do not offer coupons. If there is a delay of more than 5 days, offer cancellation". A clear rule says what not to do and what to do instead.
- You want to make sure no refund goes over R$ 200 without approval. Where does that live?
- In the prompt and in the code that runs the refund. The prompt guides, but a vague sentence can beat it. The code checks the amount before running.
- Claude Docs, Prompting best practices ↗
- Anthropic, Effective context engineering for AI agents (Sep 2025) ↗
- OpenAI, GPT-5 prompting guide (Aug 2025) ↗
- OpenAI, Prompting ↗
- Simon Willison, Anthropic system prompts (Aug 2024) ↗
- OpenAI, A practical guide to building agents ↗
- Claude Docs, System prompts (release notes) ↗
- TechCrunch, Anthropic publishes the system prompts that make Claude tick (Aug 2024) ↗
- Anthropic, Prompt engineering interactive tutorial ↗