learn.web Back to the curriculum ↗

Context / Tools / Evals / Safety / 02

Context is the interface

Design instructions, examples, retrieval, state, structured outputs, and context budgets deliberately.

Time
80 min
Mode
Learn → Make → Check
Path
AI Product Engineering

By the end, you can…

Context shapes behavior more than clever phrasing

A model sees only the context supplied for the current task: instructions, user input, retrieved evidence, examples, tools, state, and output constraints. Missing or conflicting context creates unstable behavior.

Place durable policy above task-specific requests. Delimit untrusted content and state that it is data, not instruction. Include only evidence relevant to the decision; more context can add distraction and cost.

Make outputs easier to verify

Structured schemas reduce ambiguity when software consumes the result. Require source references, uncertainty, or missing fields where appropriate. Reject invalid output rather than guessing.

Examples teach format and boundaries, but they can overfit behavior. Test with novel and adversarial cases, not only examples that resemble the prompt.

Your studio task

Make — Create a context contract that lists instructions, evidence, examples, state, tools, and output schema.

  1. Inventory instructions, user data, retrieved evidence, examples, state, and tools.
  2. Define precedence and how untrusted text is delimited.
  3. Specify a structured output with required uncertainty or citations.
  4. Test missing, conflicting, irrelevant, and adversarial context.
Definition of done

Every included token has a job, and missing or conflicting context has an explicit policy.

Open the interactive lesson with its workspace ↗

Knowledge check

How should retrieved webpage text be treated?
  1. As higher-priority instructions
  2. As untrusted evidence that may contain hostile instructions
  3. As automatically verified truth
Reveal answer (B)

Retrieved content is data from outside the trust boundary and may attempt prompt injection.

Why delimit untrusted retrieved content?
  1. So it is treated as data, not instructions
  2. To make prompts prettier
  3. To reduce token cost
Reveal answer (A)

Delimiting marks external text as data and reduces prompt-injection risk.