Yesterday we wrote system prompts by hand. Today we made them configurable, so the tutor’s teaching style becomes a runtime choice rather than an edit to the code.
1. The Three Tones
| Tone | Behaviour |
|---|---|
| Detailed | A tutor giving full explanations with examples |
| Revision | Crisp and minimal, for recall before an exam |
| Beginner | Assumes zero prior knowledge, starts from ground zero |
Same question, same code. Only the system prompt changes.
2. Tones as Data, Not Code
TONES = {
"detailed": "You are a tutor. Explain thoroughly with examples.",
"revision": "Give crisp, exam-ready points. No elaboration.",
"beginner": "Assume zero knowledge. Explain from first principles.",
}
tone = TONES.get(user_choice, TONES["beginner"])
Use .get(), not TONES[user_choice]. Square brackets raise a KeyError and kill the program when someone types a tone that doesn’t exist. .get() lets you fall back to the beginner tone instead.
Rule of thumb: any time user input becomes a dictionary key, use .get() with a default.
3. A Reusable Options Helper
def base_options(**kwargs):
opts = {"system_prompt": tone, "max_turns": 1}
opts.update(kwargs)
return ClaudeAgentOptions(**opts)
**kwargscollects any extra settings the caller passes.ClaudeAgentOptions(**opts)unpacks the dictionary into named arguments.- Adding tools or any other SDK property later means updating one dictionary, not every call site.
That’s the real point: configuration lives in one place.
4. Driving It from Input
The main() function now asks for two things: the question, and the tone. Testing showed the difference clearly — ask about data types and the beginner tone builds up from what a type even is, while the revision tone returns a categorised summary.
On cost: roughly 2–3 cents per question. That’s the default model doing the work. Set Haiku in your options and it drops by close to a factor of ten for this kind of task.
5. Workflow Tips
- Paste LLM output into a
.mdfile and preview it with Ctrl+Shift+V (Cmd+Shift+V on Mac). Markdown in a terminal is unreadable. - Keep a VS Code shortcut cheat sheet nearby rather than memorising shortcuts.
6. Honest Status: This Is Not Yet an Agent
What we have is a configured model call. No tools, no memory. It can’t act and it can’t remember you.
Next session we switch from query to ClaudeSDKClient and add:
- Session IDs, so several simulated students (A, B, C) stay separate
- Conversation history, so the tutor remembers what each student asked before
That’s when it starts behaving like a tutor rather than a search box.
✅ Action Items
- Implement the tone dictionary and the options helper yourself. Type it; don’t copy it.
- Run the same question through all three tones and compare the outputs side by side.
- Switch the model to Haiku and check the cost difference.
- Missed the last session? Review the posted summaries before the next one, since we build directly on them.
Note: today’s Python class was cancelled.
⏭️ Next up: the Claude client, session IDs and multi-user memory.
