--- title: "What is context engineering?" excerpt: "Deciding what goes into the model's context window — and what stays out. The discipline separating a reliable AI system from one that works until it doesn't." definition: "Context engineering is the practice of deliberately curating what an LLM sees in its context window — instructions, retrieved data, tools, and history — to maximize relevance and reliability while staying within the token budget." date: "2026-07-09" lastModified: "2026-07-09" author: "Teo Deleanu" authorAvatar: "/team/teo.jpg" tags: ["Context Engineering", "AI Engineering", "Production AI"] keywords: - "what is context engineering" - "context engineering explained" - "prompt engineering vs context engineering" --- Context engineering is the work of deciding what enters the model's [context window](/glossary/context-window) on each call — and, just as importantly, what to leave out. Prompt engineering is about wording the instruction; context engineering is about assembling the entire payload the model reasons over. ## Why it matters in production A model can only be as good as its context. The best prompt in the world fails if the relevant fact never made it into the window, and the clearest instruction gets buried if it competes with a wall of irrelevant retrieved text. As systems grow — more tools, longer history, more retrieved documents — the context window becomes the bottleneck, and managing it becomes the job. This is why agents [fail in production](/blog/why-ai-agents-fail-in-production) far more from bad context than from a bad base model. ## The common mistake Treating the window as free space to fill. Appending every message, every tool result, and every retrieved chunk "just in case" produces a bloated context that costs more, runs slower, and reasons worse — the [lost-in-the-middle](/glossary/context-window) problem in action. Adding context is not neutral; irrelevant tokens are a tax on every downstream decision. ## How we actually use it We curate ruthlessly: [rerank](/glossary/reranking) retrieved passages down to the few that matter, compress conversation history instead of appending it forever, and design a tight [tool catalog](/blog/context-engineering-tool-catalog) so the model chooses well. In [multi-agent systems](/glossary/multi-agent-system), each agent gets its own clean, minimal context — which is much of why decomposition helps at all.