AI Glossary
Context engineering
context engineering, context design, context management
Context engineering is the practice of selecting, ordering and trimming everything that enters a model's context window — instructions, data, conversation history and tool outputs — so the model has exactly what it needs for the task and nothing more.
- Decides what enters the context window and in what order: instructions, data, history, tool outputs.
- Broader than prompt engineering — it covers the entire context, not just the wording of a single instruction.
- Critical in agents and RAG, where the context is built dynamically and the window limit is easy to exceed.
Context engineering responds to the fact that a model's answer quality depends not only on the instruction itself, but on the whole body of information the model can see at that moment. That body is made up of system instructions, input data, the history of the earlier conversation and the results returned by tools. The job of context engineering is to pick the right elements, arrange them in a sensible order and cut out whatever is redundant, because the context window has a finite capacity, and an excess of data can distract the model and drive up cost.
This should not be confused with prompt engineering. Prompt engineering focuses on the wording of a specific instruction — the role, the examples, the expected format. Context engineering is broader: it covers the management of the entire stream of information flowing into the model, including what the system appends, not just what the human wrote. The prompt is one element of the context, but it is not the whole context.
In real deployments, context engineering becomes critical wherever the context is built on the fly. In RAG solutions you have to decide how many — and which — passages from the knowledge base to attach to a query, so as not to flood the model with irrelevant text. In agents there is the added job of managing the agent's memory and the history of its steps — without deliberately curating the context, an agent quickly fills the window with irrelevant data and loses the thread of the task.
Related terms
Related articles