Context engineering is the practice of deciding what a large language model gets to see in its context window on each call: system instructions, tool definitions, retrieved documents, conversation history, memory, and tool results. The goal is to give the model exactly the high-signal information it needs for the next step. The term took off in June 2025, and Anthropic defined it in a September 2025 guide as the set of strategies for curating and maintaining the optimal set of tokens during inference.
How Is It Different from Prompt Engineering and RAG?
The three cover different scopes. Prompt engineering is about writing one good instruction. RAG is about retrieving a few relevant passages from a knowledge base into the window. Context engineering governs everything that enters and leaves the window on every turn: which instructions to write, which documents to retrieve, how many turns of history to keep, how to compress old records, and whether to delete tool results once used. In July 2025, LangChain grouped the common techniques into four moves: write, select, compress, and isolate.
A bigger window does not mean the model can do more. In July 2025, Chroma tested 18 models and found that performance grows increasingly unreliable as inputs get longer, a phenomenon often called context rot. Tokens are also money: stuffing the window costs more and lowers quality, so filtering is itself a way to save.
Three Common Misconceptions
The first misconception is equating it with prompt engineering. A good prompt is only one part of the job; tools, memory, and history need managing too. The second is that more retrieved material is always better: low-signal content can push the key facts out of the model's attention. The third is that you can set it up once and forget it. Every turn of an agent produces new tool results and conversation, so the context has to be reorganized each turn or the run drifts further off course.
When Is Context Engineering Worth Doing?
Multi-turn agents need it most. A customer-service assistant, for example, might keep only the current question, the order status, and the last few turns, compress older tickets into summaries, and delete tool results once used. Single-turn questions and fixed-template generation do not need it; a clear prompt is enough. A simple test: does the task span multiple turns, does it call tools, and does its history keep growing? If two of the three apply, the context deserves serious design.