Your bookmarks

Loading your bookmarks

Latest updates

New courses, skills, book chapters, and site improvements will appear here.

Create free accountSign upDashboardDashboard

Context engineering

  • Context
  • Standard term
4 steps

Context engineering is deciding what information an AI model receives with a request, and in what order and form, so it gets the documents, examples, instructions, and tools the task needs and little else.

Besides its training, a model works only from what arrives with each request, and inside an app or agent, software you never see puts most of that together. The model weighs all of it at once, so a missing fact gets guessed at, and an outdated one competes with the right one.

Where you’ll meet it

The AI assistant in your company's shared drive answers questions from the files it finds there. You ask how much a hotel night can cost on a work trip, and it quotes the limit from a draft policy someone left in an old project folder.

What to do

Tell whoever manages the drive, and ask them to move old drafts out of the folders the assistant searches, or to point it at the folder that holds the current policies. Until that's done, look at which file it quotes before you rely on a number.

Easy to mix up

Prompt engineering happens while someone drafts and tests a prompt. Context engineering happens with every request, often in code that picks the documents, examples, and tools while an agent runs.

Check yourself

A shopping agent compares laptops. At each step, its app sends the model the whole session so far, including every product page it has opened. Forty pages in, it describes one laptop's battery life with another laptop's figures. Which change is more likely to fix it?

Go deeperAccuracy falls as inputs grow, and order affects speed and price

The name spread in 2025 among agent builders, for whom a prompt's wording was only part of the job. Anthropic's engineering guide treats context as a limited resource. Chroma's research on context rot found accuracy falling as inputs grow, and the “Lost in the Middle” study found models use mid-input facts less well than those at either end.

Order affects speed and price as well. When the start of a request matches an earlier one word for word, providers can reuse their processing of it, a feature called “prompt caching.” So builders put the parts that rarely change first, such as standing instructions and descriptions of the agent's tools, and new material last.

Practice Modern AI

Or take the learning quiz on a mix of every set