Definition
What is Context engineering?
Context engineering is Context engineering is the practice of choosing and maintaining what goes into an AI model's context window at each step, so an agent has the right information to do the job.
Context engineering is the work of deciding what information an AI model sees when it produces each answer or takes each step. Anthropic describes it as the set of strategies for curating and maintaining the best set of tokens during model use, including information that arrives from outside your prompt.
Beyond the prompt
Prompt writing is about the instruction you type. Context engineering is wider. For a chatbot, the model's input is mostly your message. For an AI agent that runs for many steps, the input also includes instructions, tool descriptions, earlier results, retrieved documents, notes and chat history. Someone has to decide what stays, what is trimmed and what is fetched only when needed.
Why it matters
A model can only use what is in front of it. Its context window is limited, and stuffing it with everything you have does not help. Anthropic's engineering team treats context as a finite resource: more material is not automatically better, and irrelevant material can crowd out what matters. When an agent builds the wrong thing, a common cause is missing or buried context, not a weak model.
Common techniques
- Selecting: include only what the current step needs, and fetch the rest on demand.
- Summarizing: compress long histories into a shorter record so the agent can keep going.
- Writing things down: save notes outside the window and pull them back later.
- Splitting work: give sub-tasks to separate agents with their own clean context.
- Connecting tools: use standards such as the Model Context Protocol so an agent can reach data and tools when it needs them.
- Reusing the stable part: keep the unchanging start of a prompt consistent so prompt caching can lower cost and delay.
An example
Suppose you ask a coding agent to add a feature. If it only sees your one-line request, it guesses about edge cases, naming and what must not change. If you give it a written spec, the relevant files and a short list of rules, the same model usually does better. You changed nothing about the model. You changed the context.
How to practice it
Treat each model call as a briefing. Ask what the model must know right now, what it can look up later, and what would only distract it. Then check the results and adjust. The skill is less about clever wording and more about disciplined editing of what the model reads.
Questions people ask
What is the difference between prompt engineering and context engineering?
Prompt engineering focuses on wording an instruction. Context engineering manages everything the model sees across steps, including tools, retrieved data, memory and history.