AI & ML — INTRODUCTION
What Is Context Engineering? How It Differs From Prompt Engineering
Ask an AI assistant the exact same question twice and it can give you a vague answer once and a sharp, useful one the second time — without you changing a single word of the question. The difference isn’t how you asked. It’s what the assistant knew.
The Quick Answer
Prompt engineering is about how you word a question. Context engineering is about everything else the model has access to when it answers — instructions it was given, earlier messages, documents it’s allowed to look up, tools it can use. Get the context right and even a simple question gets a great answer. Get it wrong and no amount of clever wording fixes it.
What the Experts Say
Context engineering refers to the set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference, including all the other information that may land there outside of the prompts.
How It Actually Works
- 1
Your question is only part of the picture. Behind the scenes, an assistant’s answer is shaped by instructions it was given, earlier messages in the conversation, documents it was allowed to look up, and tools it can use — all of that together is its "context."
- 2
Same wording, different context, different answer. Ask the exact same question twice — once with no background information, once with the relevant facts included — and you can get a completely different quality of answer, without changing a single word of the question itself.
- 3
More isn’t automatically better. Dumping every possible piece of information in doesn’t help — irrelevant details compete for the model’s attention with the details that actually matter, the same way a cluttered desk makes it harder to find the one paper you need.
- 4
It’s a curation problem. Good context engineering means picking the smallest set of genuinely useful information for the task at hand — not the most information possible.
Same Question, Different Context
Below is one fixed question, asked to a support assistant. The wording never changes — only what background information the assistant has been given. Watch how much the quality of the answer swings.
Pack the Assistant’s Backpack
Here’s the harder part: an assistant can’t carry unlimited information either — every extra fact still has to compete for attention with everything else. Below is a small backpack with only 3 slots and a pile of candidate facts about a customer. Some genuinely help answer the question; some are just noise. Pick wisely.
👉 Try filling all 3 slots with low-value facts first, then swap in the high-value ones and watch the score change.
Fun Fact
Anthropic calls the opposite failure mode “context rot” — the more irrelevant or low-value information gets crammed in, the less reliably a model can find and use the details that actually matter, even though technically nothing was deleted. It’s less like the assistant forgetting something and more like trying to find one important note on a desk buried under a hundred unrelated ones.
Test Yourself
What is context engineering primarily concerned with?
Why doesn’t simply giving the model more information always help?
Ready for the engineering side — how system prompts, tools, and retrieved data actually get assembled into one context, and how production agents manage it over long runs? Continue to the Intermediate level →