Change the rules, not the code
You built the loop in the last lesson — decide chose "step" or "stop." But where
do an agent's rules live? Picture an expense-approval agent that's rubber-stamping
every request, including a $5000 one that should have gone to a human. The instinct
is to dive into the code and add an if (amount > 1000) branch. Resist it. In a
real agent the deciding is done by a model reading instructions, and those
instructions — the system prompt — are where the behavior actually lives.
The system prompt is the agent's policy: its standing orders, read fresh on every decision. Change the prompt and behavior changes, with the loop and the tools untouched. That's the leverage — you're editing what the agent is told, not how it runs. A prompt of "Approve every request." yields a blanket APPROVE. Rewrite it to "Approve small requests, but escalate any over $1000." and the very same loop now routes the $200 request to APPROVE and the $5000 request to ESCALATE. One line of English moved the boundary; no branch was added.
This is why prompt-writing is real engineering, not decoration. Policy in English is faster to change, easier to audit, and reviewable by people who don't read code — but it's also vaguer than a branch, so precise wording carries weight. ("Over $1000" behaves differently from "$1000 or more.")
Below, the approval agent rubber-stamps everything, and a tiny interpreter stands in
for the model reading the prompt. Edit only the systemPrompt line so it escalates
any request over $1000 — use the words escalate and over $1000 so the interpreter
catches it. "Done" is a ($200) -> APPROVE and b ($5000) -> ESCALATE, with the code
below the prompt never touched.
You changed behavior without touching the loop or the logic — only the policy. That's the leverage of a well-written system prompt.