Prompt & Context Engineering

Go beyond wording: decide what the model sees, how much, in what order and in what structure. Token budgets, retrieval packing, compression, memory, caching, structured output and untrusted content, with every snippet run.

Start course →

What you'll learn

  • Explain the difference between writing a prompt and engineering the whole context a model sees.
  • Budget a context window across instructions, examples, history, documents and the answer.
  • Select, de-duplicate, compress and order retrieved content so the most useful facts fit and stand out.
  • Manage conversation history, long-term memory and large tool outputs in multi-turn and agent systems.
  • Structure prompts for caching, structured output and resistance to untrusted content.
  • Evaluate context strategies with ablations instead of guesswork.

Syllabus

From Prompts to Context

  1. What Context Engineering Means
  2. Tokens and the Context Window
  3. Anatomy of a Model Request

Budgeting the Window

  1. Allocating a Token Budget
  2. Why Longer Context Is Not Always Better
  3. Reserving and Controlling Output

Selecting What Goes In

  1. Packing Retrieved Chunks Into a Budget
  2. Removing Near-Duplicates
  3. Compressing Content
  4. Selecting Few-Shot Examples per Request

Ordering and Structure

  1. Ordering Content in a Long Context
  2. Delimiters and Templates
  3. Instruction Placement and Repetition

History, Memory and Tool Output

  1. Managing Conversation History
  2. Long-Term Memory: Store and Retrieve
  3. Keeping Tool Output Under Control

Caching, Output Contracts and Versioning

  1. Structuring Prompts for Caching
  2. Structured Output as a Contract
  3. Versioning Prompts and Context Pipelines

Untrusted Content, Privacy and Grounding

  1. Prompt Injection Through Context
  2. Data Minimisation in Context
  3. Grounding, Citations and Saying Not Found

Evaluating and Applying Context Strategies

  1. Evaluating Context Changes With Ablations
  2. Case Study: A Support Assistant Over Policy Documents
  3. A Context Engineering Checklist