Context engineering
Choosing what goes into a model's context so it has what it needs and nothing more.
An LLM works with two things: what it learned in training and what sits in its context window right now. Context engineering is the job of deciding what goes into that window at each step: the instructions, the relevant documents, the conversation so far, the tool definitions, the results of earlier tool calls. The term spread in 2025 as a broader cousin of prompt engineering, which focuses on wording a single request well.
It matters most for AI agents that work through many steps. Every tool result, file and message piles up, and even with a huge context window, more is not better: as the window fills, models get slower and more expensive, and they can lose track of details buried in the middle. A well-built agent keeps its context lean and relevant.
Common techniques: fetch only the relevant pieces with RAG or search instead of pasting whole documents; summarize or compact old turns of the conversation; let the agent write notes to a file and read them back later; give a sub-agent its own clean context for a side task and keep only its summary; load detailed tool instructions only when they are needed. The guiding question is always the same: what is the smallest set of information that lets the model do this step well?
Keep in mind
- It decides which instructions, data and history the model sees at each step.
- More context is not always better: it costs money, time and attention.
- Key techniques: retrieval, summarizing, notes and sub-agents.
- Prompt engineering is about wording; context engineering is about the whole input.