AI glossary
What is Context engineering?
Also called Context management ·
Context engineering is the practice of deciding what information goes into a language model's context window at each step, including instructions, retrieved documents, tool definitions, memory and conversation history, so the model has exactly what it needs and nothing that distracts it.
How it works
A model only knows what is in its context window for the current request. In a simple chat that is a system prompt and a few messages. In an AI agent that runs for dozens of steps, the context fills with tool results, file contents and old turns. Anthropic's engineering guide describes context as a finite resource with diminishing returns: the more tokens you add, the harder it becomes for the model to use all of them well.
Context engineering is the set of choices that manage this:
- Select: retrieve only the relevant documents (RAG) instead of pasting everything.
- Load just in time: give the agent tools to look things up (search, read a file) rather than preloading data it may not need.
- Compact: summarise long histories and drop stale tool output once it has been used.
- Remember outside the window: write notes or task lists to files or a memory store and read them back later.
- Isolate: hand focused sub-tasks to sub-agents with their own clean context and take back only a summary.
- Keep tools lean: a small set of clear, non-overlapping tools costs fewer tokens and causes fewer wrong calls.
Why it matters
Most agent failures are not the model being "not smart enough". They come from missing information, contradictory instructions, or a context so full of noise that the key fact gets lost. Large context windows do not remove the problem; they make it cheaper to be careless. Good context engineering lowers cost and latency and makes long tasks finish reliably.
Example
A coding agent is asked to fix a bug. A naive setup pastes the whole repository into the prompt. A context-engineered setup gives the agent a short project guide, search and file-read tools, and a rule to keep a running notes file. The agent searches for the failing function, reads three relevant files, fixes the bug, and summarises earlier steps when the history grows long.
Questions people ask
Is context engineering replacing prompt engineering?+
It extends it. Writing good instructions is still part of the job, but agents also need the right documents, tools, memory and history in context at each step, and managing all of that is context engineering.
What is a context engineer?+
It is a role name some teams use for the engineer who designs what an AI system's model sees: retrieval, memory, tool lists and prompt templates. In practice it is usually part of an AI or software engineer's job.
Related terms
Sources
- Effective context engineering for AI agents, Anthropic
Go deeper
Prompt and Context EngineeringWhat Is Context Engineering? Techniques for Reliable AI AgentsContext engineering is curating everything an LLM sees, not just the prompt. Where the term came from, why context rots, and techniques for reliable agents. · 9 min read
Prompt and Context EngineeringContext Engineering vs Prompt Engineering: What's the Difference?Prompt engineering shapes the instructions; context engineering manages everything the model sees. Side-by-side table, worked example and when each matters. · 7 min read