Context Type 1-2: Instructions and Examples
~12 min read
The book's CPU/RAM mental model for context engineering, then the first 2 of its 6 context types: Instructions (who/why/how) and Examples (behavioral demonstrations).
This course introduces context engineering with a memorable analogy: if the LLM is a CPU, then the context window is the RAM. You're essentially programming the 'RAM' with the perfect instructions for your AI. This framing matters because it reframes what might look like 'just writing a good prompt' as something closer to systems engineering — deliberately deciding what data structure occupies limited, valuable working memory.
This course argues that production-grade LLM apps don't just need instructions but rather structure — the full ecosystem of context that defines their reasoning, memory, and decision loops. All advanced agent architectures now treat context as a multi-dimensional design layer, not a line in a prompt. To operationalize that, this course gives a mental model of exactly 6 named context types. This subtopic covers the first two.
Type 1, Instructions, defines the who, why, and how: who's the agent (PM, researcher, coding assistant — a specific persona or role, not a generic assistant); why is it acting (its goal, motivation, and intended outcome — what is this agent actually FOR); and how should it behave (steps, tone, format, constraints — the operational rules governing its output). Instructions are the closest thing to a 'traditional' system prompt, but framed here as one SPECIFIC layer among six, not the entirety of context engineering — a common mistake this course is implicitly correcting is treating instructions as the whole job when they're really just the first of six.
Type 2, Examples, shows what good and bad look like. This includes behavioral demos, structured examples, or even anti-patterns (showing the model what NOT to do, not just what to do). This course's justification is direct and important: models learn patterns much better than plain rules. An instruction like 'be concise' is a rule the model has to interpret abstractly; an example showing an actual concise response in the exact desired format teaches the SAME thing through pattern-matching, which LLMs are specifically good at, rather than through abstract rule-following, which they're comparatively weaker at. This connects to the few-shot learning concept from the agentic-ai-terms-glossary topic elsewhere in this curriculum — Examples IS few-shot learning, given a formal place in this course's context-type taxonomy.
💻 Code example
# Modeling Instructions and Examples as distinct, separately-
# assemblable pieces of an agent's context -- the book's point that
# these are two DIFFERENT layers, not one generic 'system prompt' blob.
def build_instructions(role: str, goal: str, behavior_rules: list[str]) -> str:
"""Context Type 1: the who/why/how."""
rules = "\n".join(f"- {r}" for r in behavior_rules)
return f"You are a {role}.\nGoal: {goal}\nBehavior:\n{rules}"
def build_examples(good_examples: list[str], bad_examples: list[str]) -> str:
"""Context Type 2: pattern-based teaching, not rule-based --
'models learn patterns much better than plain rules.'"""
parts = ["GOOD examples:"] + [f" - {e}" for e in good_examples]
parts += ["BAD examples (anti-patterns, avoid this):"] + [f" - {e}" for e in bad_examples]
return "\n".join(parts)
instructions = build_instructions(
role="customer support agent",
goal="Resolve the user's billing question in one reply",
behavior_rules=["Be concise (under 3 sentences)", "Never share internal account IDs"],
)
examples = build_examples(
good_examples=["Your refund was processed on May 2nd and should arrive within 5 days."],
bad_examples=["Let me check on that for you! So, according to our systems, records show..."],
)
print("=== Instructions ===")
print(instructions)
print("\n=== Examples ===")
print(examples)
💬 Deep Dive with AI
Key points
- •The book's mental model: if the LLM is a CPU, the context window is the RAM — context engineering means deliberately programming that limited working memory
- •Production agents need structure across a multi-dimensional context layer, not just one instruction embedded in a prompt line
- •Context Type 1, Instructions, covers the who (persona/role), why (goal/motivation), and how (steps/tone/format/constraints) of the agent
- •Context Type 2, Examples, shows good AND bad behavioral demonstrations — because models learn patterns much better than plain rules
- •Examples formalizes few-shot learning as one of six distinct context types, not folded generically into 'the prompt'