# What is Context Engineering? Also called context management. Context engineering is the practice of deciding what information occupies an agent's context window at each step, including instructions, retrieved documents, tool definitions, prior messages, and working state. It treats the context window as a scarce resource to be curated deliberately rather than as a buffer that accumulates everything the run has touched. The term gained currency as agent runs grew long enough that context management became the dominant engineering problem. A single prompt fits comfortably in a window, but a run with hundreds of tool results does not, so the question shifts from how to phrase an instruction to what should still be present at step ninety and what should have been discarded or externalized. The usual levers are selection, compression, and externalization. Selection means retrieving only the tool definitions and documents relevant to the current phase. Compression means summarizing older turns into a shorter record. Externalization means writing findings to a file or store and reloading only what a later step needs, which keeps details recoverable rather than lost. Two failure modes bracket the practice. Too much context degrades attention and cost, with relevant details buried among tool schemas and stale results. Too little context makes the agent repeat work it already did or contradict a decision it already made. Neither is visible from the final output alone, so diagnosis requires reading what was actually in the window. The label is recent and somewhat contested, and some practitioners regard it as a rebranding of prompt engineering extended over time. The distinction usually drawn is that prompt engineering shapes a single request while context engineering governs what persists, changes, and disappears across many steps of one run. ## Key points - Curates what occupies the context window at each step - Main levers: selection, compression, externalization - Too much context degrades attention; too little repeats work - Diagnosis requires inspecting the window, not the output - Recent term, sometimes treated as prompt engineering over time ## In practice An agent processing a long document set loads only the tool definitions for its current phase, keeps the last ten messages verbatim, and replaces everything older with a running summary plus a file of extracted findings. At step eighty its window holds roughly the same number of tokens as at step ten, and rereading the findings file restores any detail the summary dropped. ## Related terms - [Agent Memory](/en/glossary/agent-memory) - [Shared Scratchpad](/en/glossary/shared-scratchpad) - [Agent State](/en/glossary/agent-state) - [Agent Loop](/en/glossary/agent-loop) - [Agent Skill](/en/glossary/agent-skill) [Back to the AI Glossary](/en/glossary)