← AI Terminology

Context Engineering

Context engineering is the discipline of selecting, structuring, and budgeting everything placed in an LLM’s context window — instructions, retrieved docs, tool results, history, and examples — for reliable behaviour.

It extends classic prompt engineering to full system context design.
Why It Matters in AI
Modern agent failures are often context failures: wrong docs, noisy history, buried instructions. As windows grow, what you include and where you put it matters as much as model choice. It is the practical craft of production LLM apps in 2025+.
Key Points
Aspect Description
Tools RAG pipelines, memory stores, prompt compilers (DSPy)
Levers Retrieval, summarisation, ordering, delimiters, caching
Related RAG, agent memory, system prompts
Practice Treat context like a scarce memory bus
Problems Lost-in-the-middle, distraction, token cost
Vs prompt eng Broader than clever wording — whole state packaging
Simple Analogy
Packing a backpack for a hike: limited space, so you choose tools carefully and put the map where you can reach it — not clever slogans alone.
Common Usage Examples
  • Order system → docs → history → user query
  • Summarise old turns; pin critical rules
  • DSPy-style compiled prompts
  • Audit token budgets per section
Summary
In short: Context engineering designs everything that enters the window — the production skill of making LLMs reliable beyond a single clever prompt.