Prompting

Context Engineering

Also known as: context management

The broader discipline of deciding what information to put into a model's limited context window, and how to organise it, to get the best results.

Choose your level

Context engineering is the art of giving an AI exactly the right information to work with, no more, no less, and putting it in the right place. A model can only "see" a limited amount at once, so success often depends less on clever wording and more on what you feed it: the relevant documents, the key facts, the right examples. It is prompt engineering grown up into managing the whole information picture.

Context engineering is the practice of curating everything that goes into a model's context window: instructions, retrieved documents, examples, conversation history and tool outputs. As models became better at following instructions, attention shifted from phrasing tricks (prompt engineering) toward what information to include.

Why it matters

  • The window is limited and costly: you must choose the most useful content.
  • Placement matters: models can neglect information buried in the middle of a long context ("lost in the middle").
  • Relevance beats volume: dumping everything in often hurts; selecting the right pieces (via retrieval) helps.

It ties together prompting, RAG and memory into one question: what should the model see, right now, to do this task well?

Context engineering is the discipline of assembling and structuring a model's input, retrieved knowledge, exemplars, tool results, history, system instructions, under context-window and cost constraints, to maximise task performance. It generalises prompt engineering beyond wording to information selection, ordering and compression, reflecting that with instruction-tuned models the binding constraint is often what is in context rather than how it is phrased.

Empirical drivers include positional sensitivity ("lost in the middle"; Liu et al. 2023), distraction from irrelevant context, and the token-budget/latency/cost trade-off. Techniques span retrieval and re-ranking, summarisation and history compression, context ordering and salience placement, chunking strategy, and dynamic memory read/write policies for agents. It is central to reliable production systems and to agentic pipelines, where context must be managed across many steps; evaluation focuses on end-task faithfulness and groundedness rather than prompt aesthetics.

← Back to the glossary

What are you looking for?