ENES

Context engineering

Choosing what goes into a model's context so it has what it needs and nothing more.

Many sources (instructions, documents, history, tools, notes) pass through a filter, and only a few selected pieces enter the model's context window

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

Go deeper

Related terms

More in AI