What is "context engineering," and how is it different from prompt engineering?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Context engineering is the discipline of curating everything that occupies the model's context window across the lifetime of a task - system prompt, tool definitions, retrieved documents, memory, conversation history, and prior tool outputs - treating attention as a finite budget to be allocated. Prompt engineering, as classically practised, optimises a single string for a single call. The term took over during 2025 (Anthropic's "Effective context engineering for AI agents" is a widely cited writeup) because agents made the single-string framing obsolete: in a 50-step agent loop, the hand-written prompt might be 5% of the tokens the model actually sees. The other 95% - tool schemas, file contents, search results, error messages, accumulated history - is what actually determines behaviour, and nobody was "engineering" it.
Full worked answer
Context engineering is the discipline of curating everything that occupies the model's context window across the lifetime of a task - system prompt, tool definitions, retrieved documents, memory, conversation history, and prior tool outputs - treating attention as a finite budget to be allocated. Prompt engineering, as classically practised, optimises a single string for a single call. The term took over during 2025 (Anthropic's "Effective context engineering for AI agents" is a widely cited writeup) because agents made the single-string framing obsolete: in a 50-step agent loop, the hand-written prompt might be 5% of the tokens the model actually sees. The other 95% - tool schemas, file contents, search results, error messages, accumulated history - is what actually determines behaviour, and nobody was "engineering" it.
Concretely, context engineering decisions include:
- What enters the window: which tools to expose this step (not all 40), how many retrieved chunks, how much of a file to read, whether history enters verbatim or summarised.
- Where it sits: stable content first for cache efficiency; critical instructions at the edges because of lost-in-the-middle; untrusted content quarantined behind delimiters.
- When it leaves: compaction of old turns, truncating tool outputs, offloading state to files/scratchpads and re-retrieving on demand, sub-agents that burn tokens in their own window and return only a distilled summary.
The key empirical justification: model quality degrades as context fills with marginal content - even well below the advertised context limit ("context rot"). More context is not monotonically better; the job is maximising signal per token.
Framing that lands well in interviews: prompt engineering is writing a good function; context engineering is memory management for LLMs - allocation, layout, garbage collection - and it's now the primary quality lever in agentic systems.
What a good answer covers
- Context engineering is the discipline of curating everything that occupies the model's context window…
- Prompt engineering, as classically practised, optimises a single string for a single call
- The term took over during 2025 (Anthropic's "Effective context engineering for AI agents" is a widely…
- The other 95% - tool schemas, file contents, search results, error messages, accumulated history - is…
- What enters the window: which tools to expose this step (not all 40), how many retrieved chunks, how…
Key terms: What enters the window · Where it sits · When it leaves
In the glossary: Context engineering · Attention · Compaction · Context rot
Interviewer follow-ups to expect
In an agent that reads large files, what specific mechanisms keep the window clean?
How does context engineering interact with prompt caching - where do they conflict?
Who owns context engineering when the "prompt" is assembled by five different subsystems?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep