# Context Engineering

> Context engineering is the discipline of curating exactly what enters an LLM's context window so it has the right information and nothing else.

**Context engineering is the practice of deliberately curating what goes into an LLM's [context window](/glossary/context-window) — instructions, retrieved data, tool results, and history — so the model has exactly the information it needs and nothing extraneous.**

It has become the central discipline for building agents, largely superseding "prompt engineering" as the unit of work. A long-running agent's context is assembled dynamically across many turns: system instructions, results from [RAG](/glossary/rag) retrieval, outputs from tools, and prior conversation. Deciding what to include, what to summarize, and what to drop is what separates a reliable agent from one that drifts or stalls.

It matters because context is a budget, not a free pile: every [token](/glossary/llm-token) costs latency and money, and model attention dilutes over long inputs so buried facts go unused. The practical craft is loading the relevant slice rather than everything — retrieving instead of dumping, compacting old turns, and trimming tool output to the essentials. The tradeoff is engineering effort: good context assembly takes work, but a focused window consistently outperforms a stuffed one. For the full discipline, see the [context engineering guide](/guides/prompting/context-engineering).

---

_Source: https://agentscamp.com/glossary/context-engineering — Term on AgentsCamp._
