AI glossary · Basic · Language models · Agents
Context engineering
Context engineering is the work of designing all the information an AI model (LLM) sees when it produces an answer. It decides which of the instructions, conversation history, retrieved documents and tool results to include, how much, and in what order.
About this term
- Level
- Basic · Technical terms you often meet in AI news
- Category
- Models & generation
- Fields
- Language models, Agents
- Added
- 2026-10-08
How it works
Apart from the knowledge it learned in training, an LLM answers based only on the text it receives as input right now (the context). But there is a limit to how much it can see at once (the context window). So there is a step of selecting, condensing and arranging what is needed from materials such as instructions and questions, previous conversation history, documents found through RAG, and tool outputs. For example, old conversation is summarized, only relevant documents are included, and tool descriptions are added only when needed. The context prepared this way is passed to the model to get an answer.
Why it matters
Even with the same model, results vary greatly depending on what information it is shown. AI agents that carry out multiple steps on their own are a particular case: as a task runs longer, tool results and conversation pile up and the context fills quickly. Include too much, and costs rise and important information gets buried. Include too little, and the model may make up things it does not know, which is hallucination. As a result, attention has broadened from writing a single good instruction to designing the whole way information is fed to the model.
Good to know
It overlaps heavily with prompt engineering. Where prompt engineering focuses on writing the instructions well, context engineering covers all the information the model sees, including the instructions. There is no fixed formula; it is tuned through experimentation for each task. A longer context window does not mean putting everything in solves the problem. It is known that the longer the input, the more likely information in the middle is missed.
Example
When a coding agent receives a user request, it does not load the entire repository but finds and reads only the relevant files. It also includes the project's rules file, and when the conversation gets long, it summarizes the earlier part to free up space. A customer support chatbot likewise picks only that customer's information, relevant FAQ documents and recent inquiry history before generating an answer.