What Is Context Engineering?

Short Answer

Context engineering is the practice of deciding everything a language model sees for each request: instructions, retrieved documents, conversation history, tool results and memory, all within the limits of the context window. It extends prompt engineering from writing one prompt to managing the whole flow of information.

  • Taught in lesson 93

Why It Matters

As AI systems grow from single prompts to agents that use documents, tools and memory, most failures come from giving the model the wrong information. Context engineering is the skill of getting the right information into the model at the right time, which is why it has become central to building reliable AI.

How It Works

The term became popular in 2025, as builders of agents found that most failures came from the model having the wrong information, too much of it or too little, rather than from the wording of the prompt.

Typical techniques are retrieving only relevant passages, summarizing or compacting old conversation turns, keeping key facts in a structured memory and putting critical instructions where the model attends best.

For each request, a context engineer decides what to include: which instructions, which retrieved passages, how much conversation history, which tool results and what memory from earlier sessions. Everything competes for a limited window and costs tokens. Good practice includes keeping instructions stable, retrieving only relevant passages, summarising long histories, removing outdated tool output and testing how changes affect answers.

Context Engineering in Practice

Everyday Example

A travel assistant keeps the traveller's dates and budget as fixed facts, summarizes older messages, and adds only the three most relevant hotel listings to each request.

Industry Example: Pharma

A regulatory assistant loads only the guideline sections and prior agency questions relevant to the current query, instead of the whole dossier, to stay accurate and affordable.

Where You Meet It

  • Agent frameworks that manage memory and tools.
  • RAG systems choosing which passages to include.
  • Long-running assistants that summarise conversations.
  • Design reviews of AI applications.

Key Ideas Around It

Context window
The space the model can see in one request.
Memory
Information kept across turns or sessions.
Retrieval
Fetching relevant information for each request.
Summarisation
Condensing history to keep key facts.

A Common Mix-Up

Context engineering is not just a new name for prompt engineering. It covers everything the model sees, much of which is assembled by code, not written by hand.

Check YourselfAn agent works well for short tasks but fails on long ones. What is a likely cause?

Its context fills with too much or outdated information, so the important facts get lost or crowded out.

Learn It on ai2hired

S8 · #93Context Engineering

Coming in Season 8, Harnessing Models (CAM). Every ai2hired lesson is free on YouTube.

Questions People Ask

How is context engineering different from prompt engineering?

Prompt engineering focuses on the instructions. Context engineering manages all the information around them, across many steps and requests.

Why does it matter for agents?

Agents run many steps and collect tool results; without managing context they run out of window, slow down and lose track of the goal.

Learn AI From Zero to Hired

Free lessons on YouTube, each one built from what real AI job ads ask for.