Last reviewed:
What is context engineering? Definition and difference from prompt engineering
Context engineering is the discipline of choosing, at each step, the full set of information placed in an AI model's context window: instructions, documents, history, tool results, memory. It extends prompt engineering: a prompt is written once, a context is managed continuously, especially in agents working on long tasks.
The term took hold in June 2025. Tobi Lütke, CEO of Shopify, said he preferred "context engineering" to "prompt engineering"; on 25 June 2025, Andrej Karpathy agreed and described it as the delicate art of filling the context window with just the right information for the next step. The idea: in a serious application, the quality of an answer depends less on how the question is phrased than on everything the model has in front of it (instructions, document extracts, examples, available tools, history). On 29 September 2025, Anthropic gave a formal definition: the set of strategies for curating and maintaining the optimal set of tokens during inference. The vendor explains why it is necessary: the longer the context, the lower the model's ability to recall a precise piece of information, a phenomenon it calls context rot. Context is a limited resource, with an "attention budget". Anthropic describes four techniques: compaction (summarising history as the limit approaches), structured note-taking outside the window, sub-agents with their own context, and "just-in-time" retrieval of data when the agent needs it. The English term also dominates in France, where the translation "ingénierie du contexte" is little used.
Concrete example
Illustrative case (fictitious company). A 60-person accounting firm in Nantes deploys an assistant that answers clients' questions about their tax deadlines. First version: a long prompt and the whole client file loaded for each question. Answers deteriorate on large files, and the token bill climbs. The team reworks the context rather than the wording: the assistant receives a short client profile (legal form, VAT regime, closing date), fetches only the documents relevant to the question, and a summary replaces the conversation history beyond ten messages. Answers become precise again and the token volume per question falls.
Comparison
| Criterion | Prompt engineering | Context engineering |
|---|---|---|
| Subject | Writing the instructions | Everything the model receives: instructions, documents, history, tools, memory |
| Timing | Written once, then adjusted | Managed at each step of the exchange or task |
| Typical case | One-off question, short task | Agent on a long task, assistant connected to data |
| Techniques | Clear instructions, examples, output format | RAG, history summarisation, external notes, sub-agents, just-in-time retrieval |
| Risk if neglected | Vague or badly formatted answer | Degrading quality, high token cost, leakage of unnecessary data |
FAQ
What is context engineering?
It is the art of choosing what the AI model "sees" at each step: instructions, documents, history, tool results. You are no longer just looking for the right wording, you are building the right working file for the model, neither too thin nor too loaded.
What is the difference between context engineering and prompt engineering?
Prompt engineering is about writing instructions. Context engineering covers everything that enters the context window, including retrieved documents, memory and tools, and manages it from one step to the next. For a one-off question, the prompt is enough; for an agent working over a long time, the context becomes the main topic.
Why does context engineering matter for AI agents?
An agent chains dozens of steps and accumulates tool results. Without curation, its context window fills up and quality drops: Anthropic calls this context rot. Summarising, taking notes outside the context and delegating to sub-agents keep an agent reliable over time.
How does it relate to the context window?
The context window is the maximum amount of text the model can process at once, measured in tokens. Context engineering decides what goes into it. A large window does not remove the need to curate: more tokens cost more and can dilute the useful information.
Is there a French term for context engineering?
"Ingénierie du contexte" exists, but the English term remains the most used, including by French technical teams. Both refer to the same practice.
See also
Further reading
Sources
- Effective context engineering for AI agents, Anthropic, 29 September 2025. https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Andrej Karpathy, post on X in favour of "context engineering", 25 June 2025. https://x.com/karpathy/status/1937902205765607626
- Context engineering, Simon Willison, 27 June 2025. https://simonwillison.net/2025/Jun/27/context-engineering/