Context engineering

Definition

Context engineering is the practice of deciding what information an AI model sees each time it works: the instructions, documents, tool descriptions, memory and conversation history. It extends prompt engineering from the wording of one request to everything loaded around it.

By Ronan Liedmeier, fractional head of growth and course author · Published 17 October 2026 · Last updated 17 October 2026

It matters most for agents and automations that run many steps on their own. A model can only act on what is in front of it, so a bloated or wrong context produces vague or wrong work.

How it differs from prompt engineering

Prompt engineering is about how you word a request. Context engineering covers the whole set of material the model holds at the moment it acts, and it never really stops: every step an agent takes is a new decision about what to load and what to drop. Anthropic's engineering team describes it as curating the best set of information for the model on each call.

That means a short system prompt with the rules that always apply, reference material pulled in only when a task needs it (often through RAG), and old conversation turns summarized or cleared before they crowd out the current job.

Example

A marketing operator runs an agent that drafts weekly ad reports. She used to paste the brand guide, every past report and all campaign data into the system prompt. Now the system prompt holds the report format and three rules, and the agent fetches this week's campaign numbers and last week's report when it starts. The drafts cost less and stop drifting off format.

Common mistake

The kitchen-sink system prompt: loading everything the agent might ever need, just in case. Most of it is irrelevant to any given step, it costs tokens on every call, and one outdated document in the pile can steer the answer wrong. Instruction files generated automatically by a coding tool make this worse. Write them by hand and keep them short.

Learn it in AI Academy

Related terms

Prompt engineering
Prompt engineering is the practice of writing and testing the instructions you give an AI model so it produces reliable, useful output. For everyday users it means writing clear briefs; for teams running AI in production it means treating prompts like versioned, tested code.
System prompt
A system prompt is a set of standing instructions given to an AI model before the conversation starts, telling it how to behave in every reply. It sets the model's role, tone, rules and output format, and people chatting with the assistant usually never see it.
Retrieval-augmented generation (RAG)
Retrieval-augmented generation (RAG) is a way of getting an AI model to answer from your own documents. A search step first finds the passages that match the question, then the model writes its answer using those passages.
Context window
A context window is the maximum amount of text an AI model can take into account at once, measured in tokens. It holds your messages, any files you add, its instructions and its own replies, and whatever doesn't fit is left out.

Sources

Browse all terms

Find your next step with AI