context engineering
The conscious planning of exactly what information, instructions, and tools the AI receives for a task, no more and no less.
In plain terms
Imagine handing a case to a new colleague. It matters what you place on their desk: if you give them nothing, they will guess; if you give them the entire archive, they will get lost. Good handover means giving them only the few files they need for the task. Context planning is the same, but for AI.
The language model only 'sees' what is immediately in front of it: the instructions, the previous part of the conversation, attached documents, search results, and descriptions of its tools. Together, this is the context. Its space is finite, and the more unnecessary material it contains, the easier it is for the model's attention to slip past the essentials.
Context engineering is therefore not about crafting a single clever sentence. It requires assembling an entire system that decides what is presented to the model, when, in what form, and what is excluded. This is particularly important for agents, which work autonomously over long periods and many steps, while information continuously accumulates.
How it works
- First, clarify what the model needs to know for the task: what is the goal, what are the rules, what background knowledge is required, and what tools are needed.
- The system then retrieves the necessary material, such as relevant document excerpts, key points from previous conversations, or user settings, and presents only this to the model.
- It compresses whatever is long: old parts of the conversation become a summary, and only the relevant part of large files is kept.
- For longer tasks, the agent writes notes to itself in an external store and retrieves them when needed, so it does not have to keep everything on its limited "workspace."
- Developers finally measure whether the model performs better and refine based on this what gets included and what stays out.
An everyday example
You ask an online store's chatbot where your package is. If its context was well designed, the system places your order data and shipping rules in front of the model in the background, so you get a precise answer. If not, the robot speaks in generalities or talks about the wrong order.
Who is affected
A common misconception
Limits and risks
- Good context does not make up for a model's missing capabilities; it only makes errors rarer, it does not eliminate them.
- If the material fed to the model is flawed, outdated, or contains malicious instructions, the model may take it at face value.
- There is no single proven recipe: what works for one task or model may not work for another, so continuous measurement and adjustment are required.
- What you put into the context is processed by the provider's system, so share personal or business secrets only with caution.
Similar, but not the same
- prompt engineering – Prompt writing focuses on how an instruction is worded. Context engineering, however, covers everything that is put in front of the model: data, history and tools.
- retrieval-augmented generation (RAG) – RAG is a specific technique for retrieving relevant documents. Context engineering is the broader practice of which this is one tool.
- fine-tuning – Fine-tuning further trains the model itself. Context engineering leaves the model unchanged and only shapes what it receives as input.
Related concepts
generative AI, large language model, AI-agent
prompt writing, context window, token, hallucination, prompt injection
A brief history
The term spread in the summer of 2025 when prominent industry figures, including Tobi Lütke, CEO of Shopify, and AI researcher Andrej Karpathy, began using it instead of 'prompt engineering' because they believe it better expresses what this work entails. In autumn 2025, Anthropic issued a separate guide on how to design the context for agents.
Where things stand
By the end of 2026, it had become a standard term among AI developers and a fundamental practice in agent building. The broader public is more familiar with the term prompt writing, which lacks a unified methodology.
Also known as
context engineering · context engineering · context engineering · context building · context engineering
Sources
This entry was machine-edited and has undergone machine expert review; the “In the news” section updates automatically from Agent Age stories.